Jump to content


Photo

mail() command help


  • Please log in to reply
2 replies to this topic

#1 cschoon

cschoon
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 06 June 2006 - 01:37 AM

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

#2 poirot

poirot
  • Members
  • PipPipPip
  • Advanced Member
  • 646 posts
  • LocationAustin, TX

Posted 06 June 2006 - 01:53 AM

Actually the 4th argument is not "from", but the optional headers.

Use this:

$headers = "From: John Smith <test@test.com>\r\n";
mail($to, $subject, $message, $headers)

~ D Kuang

#3 cschoon

cschoon
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 06 June 2006 - 02:17 AM

[!--quoteo(post=380443:date=Jun 5 2006, 09:53 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ Jun 5 2006, 09:53 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Actually the 4th argument is not "from", but the optional headers.

Use this:

$headers = "From: John Smith <test@test.com>\r\n";
mail($to, $subject, $message, $headers)
[/quote]

Worked like a charm! Thanks




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users