Multiple Mailer Configurations with ActionMailer

So I just started using the wonderful service from Postmark which makes processing inbound emails absolutely a breeze, but I was a little concerned with how much it was costing me to send notification emails to the admins on the site, along with exception notifications. Even though Postmark is a reasonably priced service, there’s no reason really to pay Rs. 0.075 per email to admins for exception notifications. So how do you set up multiple mailer configs in your Rails app? It’s trivially simple actually - say you have two Mailer classes a User Mailer and an AdminMailer. Set up your normal Gmail smtp mailer as usual

config.action_mailer.delivery_method = :smtp

config.action_mailer.smtp_settings = {
  :address              => "smtp.gmail.com",
  :port                 => 587,
  :domain               => 'svs.io',
  :user_name            => 'svs@svs.io',
  :password             => 'N0tMyPa55w0rd!',
  :authentication       => 'plain',
  :enable_starttls_auto => true  }

and then add the magic line which tells UserMailer to use postmark

UserMailer.delivery_method = :postmark
config.action_mailer.postmark_settings = { :api_key => "n0tmY-ap1-kev-e1th3r" }

simple!