Menu

Email Header

Help
2006-04-21
2013-06-03
  • sunflower3838

    sunflower3838 - 2006-04-21

    I'm having a problem getting the "From" in the email header to be anything except my server.

    Here is my code:

    mail("myemail@domain.com, myemail2@domain.com","Form submitted at your website",$message,$email)

    So the email is coming "nobody@myserver.com" and it puts the $email info in the message body at the top.

    Thanks.

     
    • TNTEverett

      TNTEverett - 2006-04-21

      The mail function has specific requirements.
      http://us3.php.net/manual/en/function.mail.php

      Basically:
      mail($to, $subject, $message, $headers);

      The best way to handle your problem is to create the $headers variable then insert it into the mail function.  This will fix your problem and allow further custimization in the future should it be needed. 

      $headers='From: $email';
      mail("myemail@domain.com, myemail2@domain.com","Form submitted at your website",$message,$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.