Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Sep 2005
    Location
    Liverpool
    Posts
    226
    Thanks
    0
    Thanked 0 Times in 0 Posts

    phpmailer addaddress

    I'm having trouble getting the addaddress portion to work, everything else is fine and dandy:
    PHP Code:
    $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:
    Code:
    To: xxx@invalid.invalid
    as opposed to
    Code:
    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.
    my mind is on a permanent tangent

  • #2
    Senior Coder chump2877's Avatar
    Join Date
    Dec 2004
    Location
    the U.S. of freakin' A.
    Posts
    2,845
    Thanks
    21
    Thanked 157 Times in 148 Posts
    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...
    Last edited by chump2877; 09-22-2005 at 10:24 PM.
    Regards, R.J.

    ---------------------------------------------------------

    Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :-)
    [Related videos and tutorials are also available at my YouTube channel and on Dailymotion]
    Get free updates about new software version releases, features, and bug fixes!
    ♪♪ …Need Web Hosting For My YouTube-To-Mp3 Conversion Software? Check Here !!… ♪♪

  • #3
    Regular Coder
    Join Date
    Sep 2005
    Location
    Liverpool
    Posts
    226
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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
    PHP Code:
    $mail->AddAddress("xxx@invalid.invalid","myname"); 
    but to no avail.
    my mind is on a permanent tangent

  • #4
    Senior Coder chump2877's Avatar
    Join Date
    Dec 2004
    Location
    the U.S. of freakin' A.
    Posts
    2,845
    Thanks
    21
    Thanked 157 Times in 148 Posts
    I used this line of code:

    PHP 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...
    Regards, R.J.

    ---------------------------------------------------------

    Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :-)
    [Related videos and tutorials are also available at my YouTube channel and on Dailymotion]
    Get free updates about new software version releases, features, and bug fixes!
    ♪♪ …Need Web Hosting For My YouTube-To-Mp3 Conversion Software? Check Here !!… ♪♪

  • #5
    Regular Coder
    Join Date
    Sep 2005
    Location
    Liverpool
    Posts
    226
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

    PHP Code:
    $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.
    my mind is on a permanent tangent


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •