Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

php mail() display name header. 2

Status
Not open for further replies.

QuietFire

Programmer
Feb 25, 2003
12
US
I am trying to make a display name show up in an email:

$headers = "From: test name\r\n";
mail($to,$sub,$mess,$headers);

My email shows:
test@xxxx.xxxx.com, name@xxxx.xxxx.com

I know there has to be a way to get "test name" to come through by itself!

Thanks,
Charles
 
Be careful, if "test name" includes a comma, you need to put it in quotes in your "From: " string:
Code:
$headers = 'From "test name, md" <test@example.com>'."\r\n";

If you don't most mail programs will have problems.

Ken
 
Thank you both for the info. I should have posted rather than just use the thank user function.

WoodyRoundUp's answer got me where I needed to be. The display name has no commas ansd is not likely to change, but I will try to remember it for the future just in case. That is the sort of thing that would give me nightmares figuring out! [3eyes]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top