Multiple ActionMailer delivery methods
Looking for a way to deliver some of your ActionMailer notifications immediately (e.g. via :smtp) and others using a delayed/queued method (e.g. :activerecord using AR-Mailer (http://github.com/adzap/ar_mailer)?
Here's how I did it. My default delivery method in my application was immedate using ActionMailer with SMTP.# set delivery method to :smtp, :sendmail or :test # or :activerecord for ar-mailer config.action_mailer.delivery_method = :smtpA corresponding model method action would look something like this;
def deliver_new_registration_notice! Notifier.deliver_new_registration_notice(self) endAnd for delayed (queued) delivery, you need to temporarily override the
ActionMailer::Base.delivery_method; def deliver_existing_member_activation! delivery_method = ActionMailer::Base.delivery_method ActionMailer::Base.delivery_method = :activerecord #needed for bulk sending reset_perishable_token! Notifier.deliver_existing_member_activation(self) ActionMailer::Base.delivery_method = delivery_method #reset it end