Jump to content

PHPMailer help


xyar

Recommended Posts

Hi all,

 

I'm desperate to find an answer, if anyone can help.  I built a referral page so existing customers of a small motel chain can send coupons to their friends and attract new business.  I built it using PHPMailer to email the PDF of the coupon to the recipient.  The problem is there appears to (still) be a bug in PHPMailer  wherein when I add multiple addresses separated by commas using the $mail->AddAddress function, it won't work, it only works if I use the $mail->AddAddress individually for each email address.  Their documentation claims it should work but it doesn't.

 

So all I'm trying to do is take a string that might have multiple email addresses separated by commas, and have it spit out individual $mail->AddAddress commands for each one so this will work for more than one address at a time.  I know this is simple but I can't figure it out to save my life.  I came across some ASP code that will do it but cannot figure out how to convert it to PHP.  I posted to the PHPMailer forum on Sourceforge back in December but never got any replies.

 

Any ideas?

 

Thanks in advance!!

Link to comment
Share on other sites

  • 4 weeks later...

<?php
  $emails = 'email@domain.com,email2@host.com';
  $emailarray=expode(',',$emails);

foreach($em as $emailarray)
    $mail->AddAddress($em);
?>

 

Your variables are backwards in your FOREACH statement.

 

Also, what is the use in posting the same code to a post that is 3 weeks old?

Link to comment
Share on other sites

  • 2 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.