Mass mail techniques?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
elmonty
Forum Newbie
Posts: 13
Joined: Tue Jan 20, 2004 9:52 am

Mass mail techniques?

Post by elmonty »

I have a PHP/MySQL site already developed. The members of the site belong to an email discussion list. This list is currently being handled by a program called SmartList. However, we keep losing email messages and the web host is not being helpful in resolving the problem.

Because SmartList is poorly documented and supported, I've been considering writing my own email list handler in PHP. It would tie into the members database a lot more naturally than a 3rd party program.

My immediate question is this:

When sending a message to a couple of hundred people, is it better to loop through the list of email addresses and call mail() for each one? Or should I call mail() once for each dozen or so addresses and BCC all those addresses in a single message?
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

It would be a lot faster to send a message using multiple BCC.
User avatar
elmonty
Forum Newbie
Posts: 13
Joined: Tue Jan 20, 2004 9:52 am

Post by elmonty »

Thank you for the speedy reply.

Does it make any difference in determining the success or failure of sending the message any particular address?

One of the things I'll eventually have to do is bounce management <yuck>.
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

you may set Return-path to some custom alias, say bounces@yourdomain.com and then hook up a script to this alias either via procmail or simple .forward file (or virtusertable.conf file if you're using Sendmail).
User avatar
elmonty
Forum Newbie
Posts: 13
Joined: Tue Jan 20, 2004 9:52 am

Post by elmonty »

I'm aware of using Return-Path, thanks. I'm just wondering if the return value and any error messages from the PHP mail() function will be any more or less useful when sending using multiple BCC.
User avatar
elmonty
Forum Newbie
Posts: 13
Joined: Tue Jan 20, 2004 9:52 am

Post by elmonty »

How do I make the messages appear to be addressed to the mailing list instead of each recipient? If I put the mailing list's name in the "To" header when I distribute it, won't that send the message to the list again, causing it to be resent ad infinitum? The only solution I can think of is to put a custom header in the message and don't distribute the message if that header exists. Is there a simpler way?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

what about making the send-out address of the list not that address.. or using a different address (that's blackholed, for instance)
User avatar
elmonty
Forum Newbie
Posts: 13
Joined: Tue Jan 20, 2004 9:52 am

Post by elmonty »

If you send a message to, for instance, somegroup@yahoogroups.com, each recipient will get a message addressed to "somegroup@yahoogroups.com", not addressed to them individually. That's what I'm trying to figure out how to do.

Now when a message comes in to somegroup@mywebsite.com, I need to handle that message and distribute it to all the members, but with each copy of the message addressed to "somegroup@mywebsite.com".
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

could probably just not send anything that has a From of the same address.
User avatar
elmonty
Forum Newbie
Posts: 13
Joined: Tue Jan 20, 2004 9:52 am

Post by elmonty »

Nope, that doesn't work either. The From address will be the original sender.
Post Reply