Doing max of N tasks per given time

Hey everyone,

I need some help. I have a Rails app on a VPS that connects to an
external SMTP server that can only send up to 250 emails per hour. If
I try to send the 251st email, it will just ignore it.

I almost bashed my head trying to setup sendmail so I can send my own
emails, but not all emails were being sent.

I basically want to send up to 250 emails immediately, and queue the
251st email til after the next hour since the max limit of 250 will be
reset. What can I use/install that does this for me? If I can avoid
installing postfix and sendmail or some other MTA program, it’ll be
way simpler for me.

Ramon T.

You should look into AR Mailer:

The basic idea is that rather than actually sending emails, your app
saves emails to the database. AR Mailer then has an external script
which can be used to send these emails in batches.

Best of luck,


Thanks, Greg. I’ve taken a look.

I can have to Mailer models that have different uses: the first could
be for immediate emailing (forgot password, account activation, etc),
and the second, for less immediate email (site notifications,
newsletters, etc) which will be a subclass of ARMailer.

Ramon T.