简体   繁体   中英

Send bulk mails to user via Amazon Simple Mail Service

In one of my web application I have to send email to my users ( all mails are transnational, user accept privacy policy and terms ans conditions).

Currently Amazon grand me to send 10000 emails per 24 hours and we can easily increase the quota. My question is we can only send 5 emails per second via amazon. So I am bit confused with the PHP script ( loop ) to handle the same. A normal PHP loop can handle this bulk emails ?

Is there any delay in while loop is available ? So that we can limit it 2-3 emails per second. Since the script is working in a cron job

Thanks in advance

This will require a little bit of code, but not much, but if you separate the task that generates emails, from the task that actually does the emailing, you could use amazon SQS and a cron job to do the mailing.

What I do is I have an SQS queue called 'EmailQueue', that contains the "TO", "Subject" and body of the email in the message. The job the generates the emails to be sent simply places all of these messages into a queue, as fast as it can/wants to.

I then have a scheduled task that runs every minute that goes to the queue and downloads a set number of emails to go out depending on the throttle in place. The cron job builds and sends the email message from the information stored in the SQS messages and deletes the message(s) as they are sent - it doesn't need access to anything else since everything required to send the email is encapsulated in the SQS message.

You control the throttle by the timing of the cron job. In my case, my job will only process up to 5 emails on each run before it exits.

Using a queue and a cron job also removes any delay that might exist for the UI user (assuming there is one), since the loading of the messages into the queue is fast, and SMTP emailing is sometimes slow it can cause a noticeable lag to the end user.

Amazon ses best option for sending bulk emails at low cost, But it's not providing best gui for their service. You can use external services like bullmailer to send emails from amazon ses.

It gives list management, campaigns, email automations manay more with detailed report for your campaigns

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM