How Do I Send Emails With PHP Showing From "Name" <> Instead of

Am writing a PHP script to email a confirmation link in order to double-opt-in emails.

When I send the email, instead of showing the email as coming from:
"Joe Smith" <> shows the email as coming from: (

For this application, HostMonster is the hosting company. So I read their support page:

...which says you are required to put a properly formatted , valid From: field in the email's header, or else it will change the From: address to (Which is what is happening, it seems.)

This page gives the following examples of properly formatted From fields:
From: "user" <>

Problem is, I don't see how I am not conforming to this standard. Here is my php code for defining the header (email addresses and names have been changed for anonymity, but the format is exactly as follows):

$header = 'Reply-To: "Joe Smith" <>\n';
$header .= 'Return-Path: "Joe Smith" <>\n';
$header .= 'From: "Joe Smith" <>\n';
$header .= "Organization: Joe Smith Corp\n";
$header .= "Content-Type: text/plain\n";

HostMonster tech support referred me to the document I already had found and applied above. They said they do not troubleshoot code, and suggested online help forums.

How can I fix this?
Joel BuhrPresidentAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Try changing From:
$header .= 'From: "Joe Smith" <>\n';


$header .= 'From: '' . "\r\n"
Joel BuhrPresidentAuthor Commented:
@becraig Tried this just now exactly as you suggested, but it still doesn't work. Thanks for suggesting, though.
I forgot to indicate the reply to:

$to      = '';
$subject = 'Subject';
$message = 'This is a test';
$headers = 'From:' . "\r\n" .
   'Reply-To:' . "\r\n" .
   'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Joel BuhrPresidentAuthor Commented:
@becraig That did the trick! Many thanks!
Joel BuhrPresidentAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.