简体   繁体   中英

Rails ActionMailer add a delay for few milliseconds before sending an email

Is there a way to achieve above at a single place, as we have lot of places to send email and can't change email sending calls to add a delay through out the application code base.

We just want to make sure that not more than X emails are being sent in 1 second.

We are using rails 2.3.5.

Thanks

EDIT

We are using Amazon SES for sending emails. Initially they allow 1 email per second. What happens if we send more than one emails per seconds. Would SES queue them or throw some exception?

  1. Make your mail sending logic async by using a job queue, for example delayed_job or resque
  2. Have a job processor that takes jobs from the queue and processes them, as such you can control the sending interval from the processor logic

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