Msg#: 4625357 posted 10:13 am on Nov 22, 2013 (gmt 0)
I help run a website with a lot of members. Throughout the day i have to email members notifications with unique content in each email. I have set up a cron job to check the database for new email notifications that need to be sent every 2 hours. The script is now taking over 2 hours to complete sending and i am looking to make it more efficient. The code below is what i use. When i time the script the delay seems to be from connecting to sendmail which is on the same server. Can anyone give me an idea on how to speed this up? Also what is the best way of finding dead email address's where domains have expired or unknown user?
Msg#: 4625357 posted 6:44 pm on Nov 25, 2013 (gmt 0)
Also what is the best way of finding dead email address's where domains have expired or unknown user?
You must process "bounces": returned mail deemed undeliverable and act on it by suspending those that will continue to fail for the forseaable future. Take care not to process it based on out-of-office replies (it's tricky!)
There are services out there that can handle huge amounts of emails being sent out (I prefer to use them over having my servers flagged as "spammer"). They do handle processing of bounces for you.
Msg#: 4625357 posted 9:38 am on Nov 26, 2013 (gmt 0)
Thanks for the replies. The script is managing to send out 7500 emails in 2 hours. The reason i close the smtp connection after every email is to avoid looking like the server is spamming. It does speed up if i leave the connection open for 15 emails and then reconnect. The slowness does seem to come from the connecting to sendmail. I will look into running multithreaded or several cronjobs.
Msg#: 4625357 posted 9:51 am on Nov 26, 2013 (gmt 0)
If you're connecting to your own SMTP server: other servers will not know either way if you dropped the connection or not. I'd suggest to keep it open as long as your script runs. It might help to make sure DNS on your server (as client) is configured so that it can do a reverse lookup of 127.0.0.1 (and the same for IPv6). sendmail does that and if it needs to wait for a time-out on DNS it'll slow things down to a crawl.