What's New in Edge Rails: ActionMailer::Base.server_settings Deprecated 11

Posted by ryan
at 10:55 AM on Wednesday, January 31, 2007



Configuring your action mailer settings just got a little tweak that you’re going to want to pay attention to, especially if you’re running off edge. Instead of using ActionMailer::Base.server_settings you’re going to want to use ActionMailer::Base.smtp_settings. The syntax remains the same, it’s just a name change:

1
2
3
4
5
6
7
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
        :address                => "smtp.mymailserver.com",
        :authentication        => :login,
        :user_name                => "me",
        :password                => "password"
}

In the 1-2-stable rails branch the use of server_settings has been deprecated, while over in edge it’s been renamed outright and you’ll need to update your usage.

Also in the same update is the ability to specify your sendmail executable location and command line arguments options with the new ActionMailer::Base.sendmail_settings (if you’re using sendmail):

1
2
3
4
5
ActionMailer::Base.delivery_method = :sendmail
ActionMailer::Base.sendmail_settings = { 
  :location       => '/usr/sbin/sendmail', 
  :arguments      => '-i -t'
} 

See the ActionMailer::Base api for further option details.

tags: rubyonrails, rails

Comments

Leave a response

  1. joostFebruary 01, 2007 @ 06:42 PM
    (Off topic) I've always wondered when ActionMailer would gain the ability to use layouts. It just seems logical. Many sites, mine especially, would benefit from a consistent look-and-feel in their outgoing emails.
  2. Matthew BassFebruary 18, 2007 @ 06:59 PM

    Agreed. I’ve had numerous instances where an ActionMailer layout would have been helpful.

  3. WilliamMarch 03, 2007 @ 03:08 AM

    Thanks. Found this off google. Fixed one of my upgrade woes :)

  4. kelyarMarch 14, 2007 @ 10:51 AM

    me too. thanks =)

  5. Mike StephenMarch 31, 2007 @ 04:20 PM

    Me too – many thanks!

  6. Marshall from WineQApril 07, 2007 @ 07:03 PM

    Helped a bunch—thanks! :)

  7. LeeApril 17, 2007 @ 09:54 PM

    Actionmailer does have the ability to use templates. See recipe 9.3 “Formating Email Messages Using Templates” in the Orielly Rails CookBook

  8. CassSeptember 16, 2007 @ 05:34 AM

    Thanks Ryan,

    It helped me solve my problem.

    Cheers

    Cass

  9. saurabh purnayeJanuary 30, 2008 @ 01:57 AM

    thanks ryan… very useful info..

  10. obiFebruary 25, 2008 @ 01:59 AM

    great stuff, bro. I found this on google too, solves my problem. thanks

  11. SwardsMay 12, 2008 @ 02:16 PM

    @lee – joost is talking about layouts, wrappers that could be used for all emails. The templates discussed in recipe 9.3 in the Rails Cookbook just talks about the views – the output that’s unique per email. The recipe is about a half a page long and meant for new rails devs.

Comment