Page 1 of 1

[PHP mail] Send mail to multiple users at once

Posted: Mon Nov 13, 2006 9:14 am
by thiscatis
Hi!

Ok, is there a way to use the mail function to send the body of the mail to emails stored in a user table?
So the method:

1. select the email accounts from the user table and put them in an array
2. use the mail() function and select all the email accounts from the sql array
3. submit the mail so it will be sent to all the accounts from the table.

Greetings,
thiscatis

Posted: Mon Nov 13, 2006 9:21 am
by m3mn0n
Yes.

Depending on the amount of e-mails, just loop through it (for or foreach).

If you're constantly doing hundreds and even thousands, you might consider breaking down the loop into sections of 100-150. Or there is also sending mail via sockets, which is a much more complex process than looping the mail() function.

Posted: Mon Nov 13, 2006 9:31 am
by thiscatis
Hi,

thanks for your reply.
It will be used for 50-100 mail accounts.
So shouldn't be a problem then I guess.

Posted: Mon Nov 13, 2006 9:33 am
by m3mn0n
Yeah, processing time isn't so bad with ~100 e-mails.

Posted: Mon Nov 13, 2006 1:14 pm
by RobertGonzalez
For something like that I'd consider using a library like Swift.