Menu

From Email in Beta Version - How to?

Help
2010-05-21
2013-06-03
  • Howard Canning

    Howard Canning - 2010-05-21

    2010-05-21 00:15:31 IST
    Hi,
    How do I adjust: the below so that when I receive an email the email address of the user is the From email address. When I receive an email from johndoe@xyz.com I want to be able to hit reply and for johndoe@xyz.com to be in the to field.

    THANKS!!!!!

    <?php

    $where_form_is="http://".$_SERVER.strrev(strstr(strrev ($_SERVER),"/")); session_start(); if( ($_SESSION==$_POST ) && (!empty($_POST)) ) { mail("support@mysite.com","Website Query","Website Query: First Name: " . $_POST . " Last Name: " . $_POST . " Your Email: " . $_POST . " Type Of Query: " . $_POST . " Subject: " . $_POST . " Your Message: " . $_POST . " "); include ("confirm.html"); } else { echo "Invalid Captcha String. Please click back and re-enter the characters in the image. Thanks "; } ?>

     
  • TNTEverett

    TNTEverett - 2010-05-21

    http://php.net/manual/en/function.mail.php

    Example #2 Sending mail with extra headers.

     
  • Howard Canning

    Howard Canning - 2010-05-21

    Thanks but how do I integrate it in my code? The from email relates to field 3. Complete Newbie to this stuff. My code is that in the processor.php file.
    Any ideas please?

    <?php
    $to      = 'nobody@example.com';
    $subject = 'the subject';
    $message = 'hello';
    $headers = 'From: webmaster@example.com' . "\r\n" .
        'Reply-To: webmaster@example.com' . "\r\n" .
        'X-Mailer: PHP/' . phpversion();

    mail($to, $subject, $message, $headers);
    ?>

     
  • Howard Canning

    Howard Canning - 2010-05-21

    Can I do something like: Totally guessing here

    $where_form_is="http://".$_SERVER.strrev(strstr(strrev ($_SERVER),"/")); session_start(); if( ($_SESSION==$_POST ) && (!empty($_POST)) ) { mail("support@mysite.com","Website Query","Website Query: First Name: " . $_POST . " Last Name: " . $_POST . " Your Email: " . $_POST . " Type Of Query: " . $_POST . " Subject: " . $_POST . " Your Message: " . $_POST . " "); include ("confirm.html"); } else { echo "Invalid Captcha String. Please click back and re-enter the characters in the image. Thanks "; } $headers = 'Reply-To: ' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

    mail($headers);
    ?>

     
  • Howard Canning

    Howard Canning - 2010-05-30

    Thanks to apalachian on another thread. The below from field code works perfect now for me. What an ordeal!

    note:my email field is field_3 so customise urs accordingly.

    <?php**

    $f_rom_em_ail = $_POST;
    $headers = 'From: ' . $from_email . "\r\n" . 'Reply-To: ' . $from_em__**__ail___;_

    $where_form_is="http://".$_SERVER.strrev(strstr(strrev($_SERVER),"/"));

    session_start();
    if( ($_SESSION==$_POST) && (!empty($_POST)) ) {
    mail("support@mysite.com","Website Customer Query","Customer Query:

    First Name: " . $_POST . "
    Last Name: " . $_POST . "
    Your Email: " . $_POST . "
    Type Of Query: " . $_POST . "
    Subject: " . $_POST . "
    Your Message: " . $_POST . "


    "$headers
    );

    includ_e("confirm._html");
    }
    el_se {
    echo "_Invalid Captcha String.";
    }

    ?>

     
  • Howard Canning

    Howard Canning - 2010-05-30

    The additional lines are :
    $from_email = $_POST;
    $headers = 'From: ' . $from_email . "\r\n" . 'Reply-To: ' . $from_email;

    and

    ,$headers

    OOPs include the comma before headers so its ",$headers);

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.