Jump to content

Mass Email?


DragonFire-N[R]

Recommended Posts

I was wondering what would be the best way to mass/bulk e-mail? I imagine something like this:

 

while ( $email = mysql_fetch_array( $emailquery ) )
{
    mail( $email['email'], $email['to'], $email['message'], 'From: user@aol.com' );
}

 

 

Wouldn't be the best method. Can someone provide a better method or perhaps a tutorial that introduces a more efficient method of mass/bulk emailing? I'd greatly appreciate it :)

Link to comment
Share on other sites

You might be able to send the email to yourself, then BCC a whole bunch of people on that email. That way the email server has to deal with sending the mail and you don't have to wait for each individual email to send. But I think some email servers have a max limit on the number of BCC you can do... maybe 100-ish? (not sure)

 

P.S. I hope you're not starting a spam server, LOL!

Link to comment
Share on other sites

lol, I'm not; I'm trying to create a newsletter but once so many people subscribe to it, it'll start stressing the server having to send all of those e-mails individually and I'm looking for a more efficient method :P

 

Thanks for the idea though, I may use that.

 

Would it be possible to send Bcc using the PHP mail() function?

Link to comment
Share on other sites

another thing you need to keep an eye on is your CPU usage ( if its a shared server).  If it is, then maybe you should look at only sending 50 emails etc at once, however havign a cron run the script once every 10 minutes over an hour period. If you do this, you woudl need to keep track of who has reeived the mail, so possibly add a field to the DB of "received" or something. 

 

Not sure if this is the best aproach, but it sounds good for mass mailing on a shared server.

 

Yours,

PC Nerd

Link to comment
Share on other sites

Thank you PC Nerd for your feedback. When you say "have a cron run the script once every 10 minutes," what exactly do you mean? Is it possible to configure the shared server to execute a PHP script regularly without requiring someone to access the file via HTTP?

 

I appreciate the info from everyone and I will be using all of the ideas :D

Link to comment
Share on other sites

link=topic=156720.msg681092#msg681092 date=1188081703]

Would it be possible to send Bcc using the PHP mail() function?

 

Yeah,


// To send HTML mail, the Content-type header must be set
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

// Additional headers
$headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . "\r\n";
$headers .= 'From: Birthday Reminder <birthday@example.com>' . "\r\n";
$headers .= 'Cc: birthdayarchive@example.com' . "\r\n";
$headers .= 'Bcc: birthdaycheck@example.com' . "\r\n";

// Mail it
mail($to, $subject, $message, $headers);

(That's taken from http://www.php.net/manual/en/function.mail.php. The BCC field can have multiple emails, they have to be comma delimited.)

 

Hope it helps.

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.