cschoon Posted June 6, 2006 Share Posted June 6, 2006 Hello,I am using the mail() function/command. whenever I Put mail($recipient, $subject, $message, $from) I have a problem with the $from variable. The email sends. The problem I am having is if my email was [email protected] when I receive the email it says it is from test. It seems to drop everything else. When I look at the return email, the proper email does show up => [email protected]. What am I missing if my variable $from = "[email protected]";Also, is there a way to have it send "John Smith" <[email protected]>??Any help would be great.Thank you in advance Link to comment https://forums.phpfreaks.com/topic/11289-mail-command-help/ Share on other sites More sharing options...
poirot Posted June 6, 2006 Share Posted June 6, 2006 Actually the 4th argument is not "from", but the optional headers.Use this: [code]$headers = "From: John Smith <[email protected]>\r\n";mail($to, $subject, $message, $headers)[/code] Link to comment https://forums.phpfreaks.com/topic/11289-mail-command-help/#findComment-42256 Share on other sites More sharing options...
cschoon Posted June 6, 2006 Author Share Posted June 6, 2006 [!--quoteo(post=380443:date=Jun 5 2006, 09:53 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ Jun 5 2006, 09:53 PM) [snapback]380443[/snapback][/div][div class=\'quotemain\'][!--quotec--]Actually the 4th argument is not "from", but the optional headers.Use this: [code]$headers = "From: John Smith <[email protected]>\r\n";mail($to, $subject, $message, $headers)[/code][/quote]Worked like a charm! Thanks Link to comment https://forums.phpfreaks.com/topic/11289-mail-command-help/#findComment-42263 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.