PHP mail()

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
thiscatis
Forum Contributor
Posts: 434
Joined: Thu Jul 20, 2006 11:00 am

PHP mail()

Post by thiscatis »

Hi,

I'm trying to send a mail to multiple recipients.
I'm querying the database for all the recipients addresses (about 50).
But I can't figure out the PHP code to format the query results (a bunch of emails) in the right form for to add
into the

Code: Select all

$to
variable.
So the email will be send to all the addresses.
Anyone?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Are you trying to build a email system yourself, as an educational experience or are you just needing to send the emails? For the latter, I'd suggest using Swift.

For the former, if memory serves, only one recipient can be listed in the normal "to" argument. Others must be added through the "additional headers" argument.
thiscatis
Forum Contributor
Posts: 434
Joined: Thu Jul 20, 2006 11:00 am

Post by thiscatis »

feyd wrote:Are you trying to build a email system yourself, as an educational experience or are you just needing to send the emails? For the latter, I'd suggest using Swift.

For the former, if memory serves, only one recipient can be listed in the normal "to" argument. Others must be added through the "additional headers" argument.
-It's for educational experience.

- So this won't work?

Code: Select all

$to  = 'mail1@gmail.com' . ', '; 
$to .= 'mail2@gmail.com';
?
User avatar
jayshields
DevNet Resident
Posts: 1912
Joined: Mon Aug 22, 2005 12:11 pm
Location: Leeds/Manchester, England

Post by jayshields »

It should do, but if not, there are alternatives, that have already been mentioned, that can be found in the PHP manaul.
Post Reply