Forum Moderators: coopster
on a generic subject line and some boilerplate message text - and then automatically email this message to all
addresses found in the DB table.
To me, this sounds conceptually simple enough (as a Neophyte):
a. drop a generic subject line into a variable named $subject;
b. drop the boilerplate text into a variable named $message;
c. create a loop for the number of rows in the table;
d. feed the email address found in each row into an $email variable;
e. send the email using mail($email, $subject, $message, "From: example@example.com");
f. loop repeats
This seems like it would work, but at the same time, it seems too simple.
Am I missing something that I need to consider for something like this?
Neophyte
So if you're sending mail to
jack@example.com , sue@example.com and bill@example.net,
put jack and sue in the same To: field. Or in the Bcc: field, if you want to hide their addresses.
The downside of this method is that some spam filters may block the mail.
I just have to ask what is the point of sending out a bunch of generic e-mails? If you're trying to market to these people, be sure of what you are getting into, there's no quicker way to piss off your users, your host, isp, etc than to mass mail...
necreegan:
This particular client is a new author. He's allowing people to download the first chapter of his book. Before downloading, they are required to complete a short form with their name, email address, city and country. There is also a check box which says "Notify me when the book is available". If they click the box, their information goes into the DB. If they don't, it doesn't.
When the book is released, the author wishes to notify all those - who wanted to be notified - of the book being available.
That's the reason and purpose of this. It is my understanding that if someone requests further information then it is not considered spam.
To your point, I will only be sending one email to one person at a time so I don't think the server overhead will be too severe. If you think I am wrong about that, please reply. This is the first time I have done anything like this.
Thanks for your input.
As for mailing permissions, it's amazing how fast people forget that they signed up for something. Be sure to record the IP address and date signed up in addition to the info you're collecting, it can save you headaches later down the road. Using a double opt in method can also help you keep complaints away.
Thanks for this tip. Don't know anything about it but I'm game to learn. I'll do a search for this socket mailing thing as suggested. Thanks!
things to watch
1. make sure you propely construct your mail headers
2. run your email message through a server with spam filters (we use spam assassin) and take a look at what x-spam-status it gives you, it will also give you the flags that it tripped and you can remove the offending words/formatting.
3. you will get reported, as ncreegan mentioned, people forget they signed up and will report you, cover yourself for that
4. don't send out massive amounts of email at once, your isp will either burn them so they cease to exist or they will shut down your account, fun stuff. Remember also that the mail function likes to be a hog and your host may get very upset if you are sending 5k email for an hour and taking up a chunk of shared resources.
5. your email will not get through to everyone, even with all precautions and testing it will still get junked
6. test it with multiple free email accounts and various clients and their spam filtering, this will maximize the number of people it gets through to
7. if you use a cron, make sure it notifies you when it is done, that you have some way of keeping track who got what when and that it takes into account when there are no emails left so it doesnt throw errors. Mine sent me text messages when it was done. Also do your calculations so that if you have to login and stop the script it isn't at 4am.
that's all I can think of before coffee ;)
[google.com...]
I think windows calls it 'scheduled tasks' or something