Forum Moderators: coopster
Do you agree? I do not need any advanced options. The only requirement is that I can send out HTML e-mails to many people, with a customized message for everybody (because everybody has a different UNSUBSCRIBE link), using PHP.
Thanks,
Paul
For what I understand, I will have problems with the script run time if I use regular mail(). But do I have the same problem with PEAR? Because I thought that would be the kind of problem that would be solved when using PEAR.
Are you having issues right now sending out email? The PEAR class you refer to basically has 3 options if I remember correctly -- the PHP mail() function, a "sendmail" option and an "SMTP" option.
If you were to invoke the PEAR class and just use the "mail" factory, you haven't really done anything different. I believe the same would hold true if you invoked the "sendmail" factory because that is simply passing the parameters to the sendmail utility via command line. The "SMTP" option would be a bit different though in that you are opening a socket directly to the SMTP server rather than *relay* via any sendmail utility.
The problem right now is that the mail() function starts to get slow, and given the expectation that more e-mail need to be send out in the future, I expect this problem only to worsen.
I have also read about those three options of PEAR. The SMTP option would be the one I need then, right? Do you have any experience with this? Are there any drawbacks? Is it difficult to configure?
Thanks in advance.
Paul
I won't worry about actually getting it into inboxes as that isn't the specific issue here.
using a company/provider to send out newsletters is a good option though I am not sure that using a free service is a good option. I like having paid companies for things as it increases their accountability when something goes wrong. I always plan for something, at some time, to go wrong.
if you do it yourself then there are multiple options, 250 emails is minuscule, I doubt most ISP's would have an issue if they all went out at once. None of the ones I have worked with have had a problem at that number. I have found most often that I start having an issue as I near 500 though.
I sent out 25K (legitimate) emails not so long ago and I used a cron and a database to do it.
I added all emails to the db and had another column for 'sent' meaning the email had been sent already. I then had my cron run every 5 mins or so and select 50 emails where sent was still 'no' and fired off the emails and stopped. It took a few days but it worked very well. It was set up to send me a message when it was finished so that i could remove the cron. For your number it would only take five executions and you could stop it easily when it was complete.
I have also played around with various ways to send emails, the mail function ended up being the best. Straight injection into the mail queue was a bit faster but it still had the exact same problems with volume so there was no real advantage. It was also much harder to trap and handle failures.
I often use multiple logs to manage it, though that has to do with the very large volumes and multiple points of failure which you probably don't need to worry about. I worked in a dedicated environment and all the servers belonged to me, including the mail servers, that afforded us some advantages as well as creating a bunch of extra issues.
As far as the PEAR package goes I have never used it but I doubt it would be any faster, I can write straight to the mail queue with out it and it will have more overhead than my method so I can't see it being any faster than what I tested.
that help any?
I'm quite fond of the mail() function, so if possible I'd like to continue using it. Just a couple checks, to make sure:
1.
From what I understand from your story, you used the same mail() function to send 25,000 messages... correct?
2.
So the only problem would be that it takes too much time if you have a bunch, which can be solved by doing them at several smaller portions... correct?
3.
To send a portion, you just looped through fifty addresses, selected from your database, and for each you mailed the message using the mail-function, right?
I now think of doing something like:
do {
mail(user, message, etc.)
} while (database_loop)
And then only like 50 addresses at once... that's the same as how you guys do it, right?
the only added piece is I update my sending table to be 'sent' if the email gets sent. When that particular mailout is done and the cron has been turned off I reset them all to no
this means that my query on who to send to looks something like
select email from emailout where sent='no' limit 50
then as my loop runs
i build the email itself
send the email using the mail function
update the row
update emailout set sent='yes' where email = $email
something like that
what you put in the email and how that is done is another story all together. Always fun trying to get emails past junk/spam filters
Thanks for all the replies people!