7

I would like to use ActionMailer to send emails from my rail app. I have an existing mail server that I would like to use, however it only supports SSL/TLS on port 465. It does not, however, support StartTLS (typically on port 587).

Can anyone suggest a way of achieving this? As far as I can tell there is no support out of the box for this. I am using Rails 3.0.7.

Alan Heywood
  • 155
  • 3
  • 10

2 Answers2

14

Yes, you can specify the :ssl option.

Set the following values in your config/environments/production.rb file:

config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
    address: 'mail.example.com',
    port: 465,
    domain: 'example.com',
    user_name: 'no-reply@example.com',
    password: 'password',
    authentication: 'plain',
    ssl: true,
}

This works with my ISP (Bluehost) for sending mail.

Matt Connolly
  • 9,608
  • 2
  • 61
  • 61
1

The only solution I am aware of at this time is monkey patching the SMTP module

http://treadpath.typepad.com/thoughtintomotion/2011/06/actionmailer-woes-integrating-with-rackspaces-email-service.html

Steven Garcia
  • 2,624
  • 2
  • 20
  • 12
  • Actually this looks like the better solution: http://stackoverflow.com/questions/3040567/rails-action-mailer-tls-certificate-issues – Steven Garcia Sep 03 '11 at 23:23