Rails ActionMailer Setup with Yahoo SMTP setting

Code kept throwing”Errno::ECONNRESET (Connection reset by peer):’ error whenever I tried to connect to yahoo’s smtp server and send a message. It took me a while to figure what the problem was: Yahoo suggest me to use port 465; but the correct port number to use is 587!

So to save you couple of hours filled with frustration and hair pullings, here’s the action_mailer setup that works:

ActionMailer::Base.default_charset = "utf-8"
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => "smtp.bizmail.yahoo.com",
:port => 587,
:domain => "www.your-domain.com",
:user_name => "username@your-domain.com",
:password => "some-password" ,
:enable_starttls_auto => true,
:authentication => :plain
}