I am trying to send email with mailgun (or Sendgrid enter code here
) and receiving this error:
Net::SMTPAuthenticationError (501 Username used for auth is not valid email address
My setup is as simple as it should be:
config.action_mailer.smtp_settings = {
:user_name => ENV['MAILGUN_SMTP_LOGIN'],
:password => ENV['MAILGUN_SMTP_PASSWORD'],
:domain => 'mydomain.co'
:address => ENV['MAILGUN_SMTP_SERVER'],
:port => ENV['MAILGUN_SMTP_PORT'],
:authentication => :plain,
:enable_starttls_auto => true
}
Any idea?
It seems like some custom code logic (we use Jumpstarter for Rails) was overriding settings in production.rb file.
The most helpful thing in my case was to take a look at rails c
(on production) and then run:
ActionMailer::Base.smtp_settings
I immediately noticed that settings were not identical to those I specified. Then it was easy to find where the real issue was.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.