Help with PHP mail function

Discussion in 'PHP' started by liam1412, Sep 2, 2007.

  1. #1
    Hi

    When using php mail if I put my e-mail address in the from will it work when they click reply or will it show as something else as its come from a mail server.

    Thanks
     
    liam1412, Sep 2, 2007 IP
  2. James.Blant

    James.Blant Active Member

    Messages:
    250
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    60
    #2
    you can set "reply-to" email in headers of you mail .
    check mail(); in documention of php.net

    <?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);
    ?> 
    PHP:
     
    James.Blant, Sep 2, 2007 IP
  3. liam1412

    liam1412 Active Member

    Messages:
    387
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    60
    #3
    Thanks for the reply. It seems to be working anyway as I have had a reply from someone who received an auto e-mail this morning
     
    liam1412, Sep 2, 2007 IP