Old 18-09-2003, 11:50   #1 (permalink)
ThePhilster
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
  Reply With Quote
Old 18-09-2003, 13:03   #2 (permalink)
dan
Iris Folder
 
dan's Avatar
 
Join Date: Apr 2003
Location: smokey
Posts: 2,672
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
  Reply With Quote
Old 20-11-2003, 18:22   #3 (permalink)
Sharif
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.
  Reply With Quote
Old 21-02-2004, 11:05   #4 (permalink)
phpology
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.
  Reply With Quote
Old 19-03-2004, 10:27   #5 (permalink)
DaiWelsh
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.
  Reply With Quote
Old 08-04-2004, 11:39   #6 (permalink)
decomplex
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.

;-)
  Reply With Quote
Old 08-04-2004, 11:55   #7 (permalink)
Brown
volkswagen yellow & gold
 
Brown's Avatar
 
Join Date: Apr 2003
Location: london, england.
Posts: 6,211
PHPlist is free, easy to install. PHPlist features
  Reply With Quote
Old 30-04-2004, 02:45   #8 (permalink)
monAmour
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.
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8