# Prioritizing Mailer Queue / Action Mailer

**URL:** <https://www.ruby-forum.com/t/prioritizing-mailer-queue-action-mailer/148106>\
**Category:** Rails\
**Created:** [September 9, 2008, 12:29pm UTC](https://www.ruby-forum.com/t/prioritizing-mailer-queue-action-mailer/148106 "2008-09-09T12:29:08Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![sgudibanda](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a9adbd/32.png) [@sgudibanda](https://www.ruby-forum.com/u/sgudibanda)\
**Post date:** [September 9, 2008, 12:29pm UTC](https://www.ruby-forum.com/t/prioritizing-mailer-queue-action-mailer/148106/1 "2008-09-09T12:29:08Z")

</div>

Hi,

I have different kinds of mails going out. For eg:

1. signup
2. notification mails  
etc

I am using mailer queue to avoid mongrels waiting on email to be sent.  
However, it makes sense to have signup mails go instantaneously whereas  
other mails can go to mailer queue.

Has anyone done such thing? Any suggestions please?

Regards,  
SG

---

<div class="post-metadata">

**Author:** ![sgudibanda](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a9adbd/32.png) [@sgudibanda](https://www.ruby-forum.com/u/sgudibanda)\
**Post date:** [September 9, 2008, 12:30pm UTC](https://www.ruby-forum.com/t/prioritizing-mailer-queue-action-mailer/148106/2 "2008-09-09T12:30:58Z")

</div>

Use the spawn plugin.

On Sep 9, 3:29 pm, Sandeep G. \<rails-mailing-l…@andreas-

---

<div class="post-metadata">

**Author:** ![sgudibanda](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a9adbd/32.png) [@sgudibanda](https://www.ruby-forum.com/u/sgudibanda)\
**Post date:** [September 9, 2008, 1:21pm UTC](https://www.ruby-forum.com/t/prioritizing-mailer-queue-action-mailer/148106/3 "2008-09-09T13:21:39Z")

</div>

Hi Mukund,

I dint look at spawning a thread, coz there we might be limited by  
number of threads that can be spawned at a time, which is system  
specific. Mails can easily hit that big a number.

I am happy with Mailer Queue plugin which queues all the mails and then  
in trigger cron job to periodically send those non-urgent mails.

But signup mails are time critical, so i was asking for suggestions to  
bypass MailerQueue to deliver these mails.

Regards,  
SG

Mukund wrote:

> Use the spawn plugin.
> 
> On Sep 9, 3:29ï¿½pm, Sandeep G. \<rails-mailing-l…@andreas-

---

<div class="post-metadata">

**Author:** ![sgudibanda](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a9adbd/32.png) [@sgudibanda](https://www.ruby-forum.com/u/sgudibanda)\
**Post date:** [September 9, 2008, 1:59pm UTC](https://www.ruby-forum.com/t/prioritizing-mailer-queue-action-mailer/148106/4 "2008-09-09T13:59:40Z")

</div>

I’ve enjoyed using ar\_mailer and it’s ar\_sendmail daemon. You can set  
it to process your email queue every 30 seconds, or 60 seconds and  
avoid having the issue of a cron job load your application. You do  
need to monitor that the daemon remains running! (god, monit, .etc)

Is 30 or 60 seconds too long to wait?

Good Luck,  
Jim Cifarelli

---

<div class="post-metadata">

**Author:** ![sgudibanda](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a9adbd/32.png) [@sgudibanda](https://www.ruby-forum.com/u/sgudibanda)\
**Post date:** [September 15, 2008, 5:34pm UTC](https://www.ruby-forum.com/t/prioritizing-mailer-queue-action-mailer/148106/5 "2008-09-15T17:34:30Z")

</div>

I actually use Mail Queue, it provides an option to bypass Queue.So on  
Signup mails, i add “!” (exclamation) at the end.

Check if ar\_mailer provides a similar option.

Xdmx X. wrote:

> JimCifarelli wrote:
> 
> > I’ve enjoyed using ar\_mailer and it’s ar\_sendmail daemon. You can set  
> > it to process your email queue every 30 seconds, or 60 seconds and  
> > avoid having the issue of a cron job load your application. You do  
> > need to monitor that the daemon remains running! (god, monit, .etc)
> > 
> > Is 30 or 60 seconds too long to wait?
> 
> how many emails are you able to handle with ar\_mailer? i’ve to send at  
> least 5000-10000 emails, but i don’t know what to use, is ar\_mailer,  
> mailer queue or something else. ar\_mailer is very nice because of its  
> daemon, but it miss the priority or the possibility to send emails  
> without queue them. This is quite important when you have a lot of  
> emails in queue (like 10000), you can send every 30-60 seconds, but if  
> you send 10000 emails, and a user signup on the site, it will get the  
> welcome/activation email after the 10000 emails are been sent… that’s  
> not very good 🙂 (e.g. 50 emails every minute would mean 200 minutes, so  
> more than 3 hours for the user to get its welcome/activation email)  
> My fear is also that do an insert of so many emails wouldn’t be good  
> too… ☹  
> Any suggestion?
> 
> thanks

---

<div class="post-metadata">

**Author:** ![sgudibanda](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a9adbd/32.png) [@sgudibanda](https://www.ruby-forum.com/u/sgudibanda)\
**Post date:** [September 14, 2008, 5:38pm UTC](https://www.ruby-forum.com/t/prioritizing-mailer-queue-action-mailer/148106/6 "2008-09-14T17:38:27Z")

</div>

JimCifarelli wrote:

> I’ve enjoyed using ar\_mailer and it’s ar\_sendmail daemon. You can set  
> it to process your email queue every 30 seconds, or 60 seconds and  
> avoid having the issue of a cron job load your application. You do  
> need to monitor that the daemon remains running! (god, monit, .etc)
> 
> Is 30 or 60 seconds too long to wait?

how many emails are you able to handle with ar\_mailer? i’ve to send at  
least 5000-10000 emails, but i don’t know what to use, is ar\_mailer,  
mailer queue or something else. ar\_mailer is very nice because of its  
daemon, but it miss the priority or the possibility to send emails  
without queue them. This is quite important when you have a lot of  
emails in queue (like 10000), you can send every 30-60 seconds, but if  
you send 10000 emails, and a user signup on the site, it will get the  
welcome/activation email after the 10000 emails are been sent… that’s  
not very good 🙂 (e.g. 50 emails every minute would mean 200 minutes, so  
more than 3 hours for the user to get its welcome/activation email)  
My fear is also that do an insert of so many emails wouldn’t be good  
too… ☹  
Any suggestion?

thanks

---

<div class="post-metadata">

**Author:** ![sgudibanda](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a9adbd/32.png) [@sgudibanda](https://www.ruby-forum.com/u/sgudibanda)\
**Post date:** [October 1, 2008, 9:44am UTC](https://www.ruby-forum.com/t/prioritizing-mailer-queue-action-mailer/148106/7 "2008-10-01T09:44:53Z")

</div>

Hi Jim,

I tried using ar\_mailer as per your suggestion, but facing issues. Can  
you please have a look at this and help me out:

[http://www.ruby-forum.com/topic/167170#733845](http://www.ruby-forum.com/topic/167170#733845)

Basically, emails are not getting stored into the DB.

Sandeep G
