Skip to content

Instantly share code, notes, and snippets.

@Godoy
Last active March 11, 2024 19:01
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Godoy/4648243 to your computer and use it in GitHub Desktop.
Save Godoy/4648243 to your computer and use it in GitHub Desktop.
Config Ruby on Rails with SMTPs - dreamhost outlook

Settings for rails smtp

config/environments/development.rb

Set raise_delivery_errors true on development

  config.action_mailer.raise_delivery_errors = true 

IMPORTANT Often as possible set from equals to username smtp. To reply, use reply_to:

class ContactMailer < ApplicationMailer
  def contact_email(contact)
    mail(to: "admin@admin.com", subject: 'Contact from site',
      reply_to: @contact.email, from: "Name<same-from-smtp@domain.com>")
  end
end

Dreamhost

config/application.rb

    config.action_mailer.smtp_settings = {
      :address              => "mail.mydomain.com",
      :port                 => 587,
      :domain               => "mydomain.com",
      :user_name            => "sender@mydomain.com",
      :password             => "password",
      :authentication       => :login,
      :enable_starttls_auto => false
    }
    config.action_mailer.perform_deliveries = true

Office 365

config/application.rb

    config.action_mailer.smtp_settings = {
      :address              => "smtp.office365.com",
      :port                 => 587,
      :domain               => "mydomain.com",
      :user_name            => "sender@mydomain.com",
      :password             => "password",
      :authentication       => :login,
      :enable_starttls_auto => true
    }
    config.action_mailer.delivery_method = :smtp
@kylelk
Copy link

kylelk commented Dec 2, 2015

Thank you for posting this, it solved my mailer problems.

@johnivanoff
Copy link

Thank you for posting. It's a time saver. I Wasn't finding anything in the DreamHost docs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment