Jump to content

mail() question


darkcarnival

Recommended Posts

hi,

im want to improve my mailing list script i made for my site.

the issue is i have a lot of users on it and the current way have it written now is too slow and i also fear the process is quitting since it takes about a minute to send it out to everyone.

now if you wish to see how im currently doing it below is how im doing it:

[code]$result = mysql_query("select * from email_list WHERE Status='Subscribed'") or die(mysql_error());
$headers = "From: member's monthly update<newsletter@metalstation1.com>\n";
//send out email.
while ($row = mysql_fetch_array($result)) {
set_time_limit(0);
@mail($row['Email'], stripslashes($subject), stripslashes($mail_message), $headers);
}[/code]

now this way works but now that my mailinglist is growing im wondering if theres a better/faster way to send out the newsletter.

thanks :)
Link to comment
Share on other sites

Hey,

as it states in the PHP manual the mail() function isn't suitable for looping and sending heaps of mail and isn't resource effective:

[a href=\"http://se.php.net/manual/en/function.mail.php\" target=\"_blank\"]http://se.php.net/manual/en/function.mail.php[/a]
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Note: It is worth noting that the mail() function is not suitable for larger volumes of email in a loop. This function opens and closes an SMTP socket for each email, which is not very efficient.[/quote]

so you might want to read up on sending mail with [a href=\"http://pear.php.net/package/Mail\" target=\"_blank\"]PEAR[/a] which would be more suitable for this.
Link to comment
Share on other sites

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.