...

View Full Version : phpmailer addaddress



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

$mail->AddAddress($srow['email'],$srow['name']);
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.

chump2877
09-22-2005, 10: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, 10: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.

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


$mail->AddAddress("name@domain.com","Name");

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, 11: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'];
$mail->AddAddress($toemail);

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

Thanks for the help.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum