Jump to content

Recommended Posts

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 test@test.com 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 => test@test.com. What am I missing if my variable $from = "test@test.com";

Also, is there a way to have it send "John Smith" <test@test.com>??

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

[!--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 <test@test.com>\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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.