Forum: Ruby on Rails Sending thousands of email with ar_mailer

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Szymon N. (Guest)
on 2008-10-22 12:12
(Received via mailing list)
Hi,

to send an email with ar_mailer I need to generate it and save it to
the db, right?

Currently the code looks very simple:
Newsletter.recepients.each do |recepient|
  NewsletterMailer.deliver_dedicated(request, recepient, newsletter)
end

But for i.e. 30000 receivers it's going to take a long while anyway.
Should I create them somehow in the background using BackgrounDRb or
something similar? If I should, then I could get rid of the ar_mailer
and just send all emails in the background... The only advantage of
ar_mailer in this case would be the functionality to send emails in
batches.

Any thoughts?
Ratnavel P. (Guest)
on 2008-10-22 14:33
The use of backgroundrb is to divorse the long running the tasks from
controllers.

if you use ar_mailer you rails app will be overloaded. So its better to
go with backgroundrb.

Cheers,
Ratnavel.
This topic is locked and can not be replied to.