| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
|
|
#1 (permalink) |
|
Registered User
Join Date: Jun 2003
Location: Belfast
Posts: 43
|
PHP Mass Mailing
Okay, so I want to create a "newsletter" for my site. Got me some subscriber emails, but what's the best way to do it in PHP... a.) Loop through all users, sending an individual email to each user? or b.) Put all the users into the BCC field of the email and send it? Is there another way? Is this likely to kill my server if I have loads of email addresses?? Ta, Phil |
|
|
|
|
|
#2 (permalink) |
|
Iris Folder
Join Date: Apr 2003
Location: smokey
Posts: 2,676
|
There's quite a lot of apps out there that'll automate this stuff for you like mailcommunicator... though it does occasionally send 4 emails to 1 person (Oops!) Bit pricey too, seen cheeper ones out there but I can't remember where right now... http://www.apexpacific.com |
|
|
|
#3 (permalink) |
|
Registered User
Join Date: May 2003
Posts: 53
|
Here is how I would do it: - Store the users emails in a database - Query to get all the emails Then do this: while(THE VARIABLE THAT WILL LOOP TO GET EMAILS, call it $var1) { mail($var1, 'subject', 'message', 'headers'); } It will email everyone. That's not as efficient as most newsletter scripts are, but it's a simpe solution. |
|
|
|
#4 (permalink) |
|
Registered User
Join Date: Feb 2004
Location: North West, UK
Posts: 4
|
I'd loop through all the addresses and send an individual email, because you can tailor the content to the recipient that way. Besides their name, you can also include a custom unsubscribe link which users always appreciate. Also, be careful sending the same email to a large amount of people all in one go using BCC - it's likely to get flagged as spam by some filters. |
|
|
|
#5 (permalink) |
|
Registered User
Join Date: Mar 2004
Location: Derby, UK
Posts: 24
|
I have written such an app for a client with a 3k recipient mailing list and the loop as suggested by sharif worked fine functionally. However I added code to record that each recipient had received a copy of the message immediately after each mail() call. That way if the script or mail server chokes half way through you can resend the message to the list (fairly) confident that no-on will get duplicates. This worked fine for a few months but last month it started failing semi-randomly and when we contacted the host they had changed their emailer to limit mails per hour. Therefore we have rewritten the app to log to the database but not actually send. Then we launch a script once an hour via a cron job which mails to 50 outstanding recipients. That way the mails are spread out and the host is happy, but we still get the message to all 3K recips over a couple of days. As the newsletter is not that time critical that is fine for my client. |
|
|
|
#6 (permalink) |
|
Blu.com.au
Join Date: Apr 2004
Location: Melbourne, Australia
Posts: 9
|
News Letter Program
Hi, I found phpMyNewsLetter v0.6, rather easy to install and doensn't seem to takeup to many resources for at least 500 users. Perhaps more, but I wouldnt be able to say from experience. I can't remember where to download it from, but i originally found it at http://www.hotscripts.com .. Hope this helps. ;-) |
|
|
|
#7 (permalink) |
|
volkswagen yellow & gold
Join Date: Apr 2003
Location: london, england.
Posts: 6,215
|
PHPlist is free, easy to install. PHPlist features |
|
|
|
#8 (permalink) |
|
Registered User
Join Date: Apr 2004
Posts: 1
|
If you're looping through your database for address sending emails to each and everyone there is a large chance for you to receive a server timeout message. The scrip which I've put together starts at 0 and up to about 50 emails then the page is reloaded and the script sends 50 more. Because of that I never get a timeout message. |
|
![]() |