Trt Trt
Trt Trt

Reputation: 5532

Action Mailer - Rails 4

I am playing around with action mailer, and I don't understand a couple of things

class MYMailer < ActionMailer::Base
  default from: "[email protected]"
  ....
end

in my production.rb file:

#config.action_mailer.default_url_options = { :host => 'www.example.com' }
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
  address:              'smtp.gmail.com',
  port:                 111,
  domain:               'gmail.com',
  user_name:            '[email protected]',
  password:             'foobar',
  authentication:       'plain',
  enable_starttls_auto:  true        }

1) First of all what is this default from: "[email protected]" ? The from value is read from my production file, and I receive emails from [email protected]. So what is the point of default from: "[email protected]"

2) Second what is the point of #config.action_mailer.default_url_options = { :host => 'www.example.com' } ? I read something on the official guides but I didn't get it. My app still sends email without it..

Thanks

Upvotes: 1

Views: 1929

Answers (1)

Roman Kiselenko
Roman Kiselenko

Reputation: 44360

1) Gmail Api Do not support sent email from different adress(protect from spam/spoof)
2) Rails can send email from self application and this options tell him what host use.

Upvotes: 1

Related Questions