About the mail fuction restrictions

Status
Not open for further replies.

cetutnx1

New Member
Messages
510
Reaction score
0
Points
0
Well a few days ago i've read in the server alerts forum that the php mail function was going to be limited, i've made an script (a newsletter) but the only way that i've found to send the mail to every one on the list, and that to field didn't have all the emails is:

PHP:
foreach($mails as $mail)  {
        mail($mail,$subject,$content,$headers);
}

as far as i've read this make the server go creazy when thew number of emails is bigger that 50

I want to know if there is any other (and better for the server) to do this

Thanks in advance.
 

Bryon

I Fix Things
Messages
8,149
Reaction score
101
Points
48
You could seperate each email address with a ", " and send all of the emails at once, or in batches of 50 or something similar.

PHP:
$to = blah@blah.com, blah@blah.com, blah@blah.com, blah@blah.com, etc.';
mail($to, blah, blah);

Something simliar to that..
 

Bryon

I Fix Things
Messages
8,149
Reaction score
101
Points
48
You put each address into the "to" argument. I was using the "blah" as an example..
 
Last edited:

Livewire

Abuse Compliance Officer
Staff member
Messages
18,169
Reaction score
216
Points
63
I think he meant the email addresses were meant to remain confidential, and he doesn't want them all available to anyone getting the email.

Example: bob@bob signs up on the mailing list, hoping to harvest some emails. The first newsletter comes like this: bob@bob, john@john, mary@mary. bob@bob throws a party because he now can spam john@john and mary@mary.

How it should have happened: bob@bob signs up on the mailing list, hoping to harvest some emails. The first newsletter comes like this: bob@bob. bob@bob throws a hissy fit of epic proportions because cetutnix1 sent out multiple copys of the same email to everyone in his mailing list, rather than compromising their privacy and sending out one with multiple to addresses. bob@bob promptly opts out of the mailing list.

I don't have a clue how to not kill the server while sending out the mailing list thoguh, so don't look at me :S

Edit: and I know those aren't real emails, but you get the idea.
 
Last edited:

Chris S

Retired
Messages
2,055
Reaction score
1
Points
38
well you could create a temp db of user e-mail and then get the first 50 and delete, then send. then wait a while and send another 50 same process
 

Jake

Developer
Contributors
Messages
4,057
Reaction score
5
Points
0
*you said most of it already demosthenes705* but if you already have them put into a database, do something were it queries the users and sends (i would say like 10-20 mails a minute would be ok) and then just have it use a while loop and get the database.

idk i think thats kinda a bit what demosthenes705 said... but thats probobly what i would do :)
 

Chris S

Retired
Messages
2,055
Reaction score
1
Points
38
ya thats what i was thinking, but if you create a temp database and something goes wrong, nothing happens to your real database unless you somehow miscode and it deletes you main database.

haha try explaining that to your members.
 

Jake

Developer
Contributors
Messages
4,057
Reaction score
5
Points
0
hehe, its called backups... people should try using them once in a while ;)
 

Chris S

Retired
Messages
2,055
Reaction score
1
Points
38
in a perfect world yes,


but anyways there are at least 2 suggestions in this thread that are good. pick and chose
 

cetutnx1

New Member
Messages
510
Reaction score
0
Points
0
Thankyou very mych for all the answers, but i don't have the emails in a MySQL database, i have them in a text file, so... i get an other way y put the emails in the BCC field, but i don't know how many mails i can put in there.
 
Status
Not open for further replies.
Top