100 emails per hour work around

Thought I’d share. I host a couple local group web pages and email lists. One uses Mailman and it works fine - email, one size fits all. Another one needs a more personal email approach. DH sets a limit of 100 emails per hour - so…

A MySql DB (id#, name, address, etc…) and a web page (table, tr per person…) and a button that says [ Send emails ]. Oh and all PHP. Send runs “select id from members where (condition…)” fputs -> file T1. Then exec (“split -75 T1”); Now I have 7 files: xaa, xab, xac… and I exec (“echo php send.email.php | at now”);

send.email.php does a “ls x??” and if $list[0] exists read it ($idlist) and runs “select name, email, duesdate, aflag, etc from members where id in ($idlist)”. Then build the member specific email ($body=) Dear Robert … news of the day/month … Oh and your dues are good for the year / expired last year / … if ($aflag) add “As a member of the social committee…”

mail ($to, “NewsLetter”, $body, $headers);

After all 75 emails have been sent “unlink ($list[0])”
Then exec (“echo php send.email.php | at now + 65 minutes”);

So it takes 7 hours to send out all the emails - So? - You kick it off at 9 PM … next morning everybody has their monthly newsletter.

Nifty! Using at to defer processing is a handy pattern.

Somewhat tangental, but are you sending email with PHP’s local mail() function, or using SMTP? If local, it looks like DH’s limit is 200/hr (probably best to stay well under that anyway).

Also, if local, do you have any trouble with mail bouncing or being marked as spam? In recent times, I’ve found local mail to be less and less reliable – maybe because it isn’t DKIM signed, like SMTP mail.

PHP mail ();
Haven’t had a lot of problems with spam marking - I think it has to do with (I think) a domain DNS setting. But I don’t remember which one.

1 Like