View Full Version : phpmailer addaddress

Rich Pedley
09-22-2005, 09:14 PM
I'm having trouble getting the addaddress portion to work, everything else is fine and dandy:

The email address is correctly sent but not for lack of trying I cannot get the name portion working. So the emails being sent feature the header:

To: xxx@invalid.invalid as opposed to
To: Me <xxx@invalid.invalid>
(email addresses obviously munged to protect the not so innocents)

Does this work for you? or am I not alone in this? and does anyone have a solution.

09-22-2005, 09:21 PM
Once upon a time, I used this tutorial to learn PHPMailer....see if you can't find your answer in here somewhere: http://phpmailer.sourceforge.net/tutorial.html#3

Edit: You should also echo out your variables to make sure that there is actually a name in there...

Rich Pedley
09-22-2005, 09:27 PM
Hi chump thanks for the speedy reply.

However I have tried as many different combo's as possible down to entering th email adddress and name directly ala
$mail->AddAddress("xxx@invalid.invalid","myname"); but to no avail.

09-22-2005, 09:42 PM
I used this line of code:


I ran this script on my server, and I got an e-mail with the To: line formatted like such:

To: Name

I suppose if you used "Name<name@domain.com>" in your code, then you would get:

To: Name<name@domain.com>

So anyway, it appears to work for me fine...

Rich Pedley
09-22-2005, 10:15 PM
aha following your comments I have come up with the following that does now work, even if it is a PITA to have to use.

$toemail="<".$srow['email']."> ".$srow['name'];

maybe it will work correctly when I don't test locally (easyphp on win98) I must remember to test it.

Thanks for the help.