Page 1 of 1

Sending multiple attachments to multiple users - phpmailer

Posted: Sat Jan 15, 2011 4:11 pm
by sHuRuLuNi
Hello,

I've searched the forums but I only find threads about sending ONE attachment, or other problems, but havent found anything about sending multiple attachments to multiple users.

Basically I loop through users database and send them an email. With one attachment it is no problem. But when I tried to use foreach or while to send MULTIPLE attachments (as in there are many PDF documents that will be sent as an attachment in the mail to all the users) it either does not send anything (when using foreach) or it only sends one attachment, usually the last uploaded (when using while).

I've tried many combinations like:

Code: Select all

while($row=mysql_fetch_array($attachmentquery, MYSQL_ASSOC)){
$mailer->AddAttachment("UserFiles/File"."/".$row['att_url']);
}
Is it the problem that e.g. this while statement is used inside another while loop (which sends the email to all the users)?
And if yes, how can it be solved. If foreach is to be used, then how?

Thank you for your help.

Re: Sending multiple attachments to multiple users - phpmail

Posted: Sun Jan 16, 2011 12:46 pm
by sHuRuLuNi
I have now for the time being deactivated the multiple attachments (only 1 will be sent), since I searched everywhere on the net, and in phpmailer forums, and no one seems to have a solution for this.

If any of you guys knows how to do this, please help. I have already tried all other suggestions I found on the net - none of them work, or there are only those where you MANUALLY insert multiple Attachments, but nothing about reading an array of attachments from DB or using while loops ...

Thank you.