PHP Mass Email Best Practices? (PHPMailer + Gmail)
email, gmail, php, standards
Solution
With an email count as "high" as 10.000 a day, I wouldn't rely on GMail (or any other) SMTP. Not that they can't handle it, obviously they can handle A LOT more. But they possibly don't want to.
Having a local SMTP server is IMO the way to go :
- It's pretty easy to set up (just DON'T let people use it without a strong authent scheme)
- Most modern MTA handle sending queues very well
- You won't have to deal with GMail (or others) deciding to block your account someday for quota reasons
Problem
I'm thinking about how to handle sending large amounts of email from my web applications, and whether there are any best practices for doing so. StackOverflow is already labeling this as 'subjective', which it may be to an extent, but I need to know the most successful way to implement this system, or whether any standardized approach exists. In my webapp, there are users who are heads of groups of 1 to 10,000 users. This user must be able to email send a message to all of these users through my system. Therefore, my system is responsible for sending up to 10,000 emails to individual users for each group head. As far as I can tell, there is no rate limit in GMail for sending messages to individuals (although there is a 500 recipient max). Right now, my current setup is: - When a message is sent through the system, it enters an email queue. - A cron script grabs messages from the queue every few minutes, and sends out those emails. - All email is taking place through GMail's SMTP server. - The actual application doing the mailing is PHPMailer. This setup, as the user base grows, will probably not suffice. The questions I have are: - Should I be using a local SMTP server instead? - Should I use a mail binary on the local machine instead? I this case, I could probably skip the queue altogether? - Is there an accepted way to do this? Thanks!