John
John

Reputation: 4706

:domain, :user_name, and :password in ActionMailer

ActionMailer::Base.smtp_settings = {
  :address              => "smtp.gmail.com",
  :port                 => 587,
  :domain               => ???,
  :user_name            => ???,
  :password             => ???,
  :authentication       => "plain",
  :enable_starttls_auto => true
}

I'm trying to use Action Mailer in Rails to send email to users. I don't quite understand what should go into :domain, :user_name, and :password. Should it be gmail.com, my Gmail username, and my Gmail password?

Upvotes: 2

Views: 678

Answers (2)

Max Dunn
Max Dunn

Reputation: 1244

Here is an example of setting up ActionMailer to use GMAil to send mail:

config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
  :address => "smtp.gmail.com",
  :port => 587,
  :domain => 'gmail.com',
  :user_name => '[email protected]',
  :password => 'my_gmail_password',
  :authentication => 'plain',
  :enable_start_tts_auto => true
}

The domain should be "gmail.com" and the username and password should be those of your Google account. To better protect your main GMail account, you should setup a separate GMail account just for sending email.

Upvotes: 2

Rodrigo Castro
Rodrigo Castro

Reputation: 1583

I don't think you need to specify domain, but yes, the user name and password must be the corresponding username/password for the sender email

Upvotes: 0

Related Questions