So, one of my projects has a SMTP server that has been configured to be used without any form of authentication. Here is my SMTP setting on config/environments/production.rb
.
config.action_mailer.asset_host = 'http://example.com'
config.action_mailer.default_url_options = { host: 'example.com' }
config.action_mailer.delivery_method = :smtp
config.action_mailer.raise_delivery_errors = true
config.action_mailer.smtp_settings = {
address: 'mail.example.com',
port: 587,
domain: 'info.example.com',
user_name: '[email protected]',
password: '',
openssl_verify_mode: 'none',
authentication: nil,
tls: false,
enable_starttls_auto: false
}
I though the authentication
mode needs to be set to nil
but, when I tried to send email, it gave me this error.
2.0.0-p481 :001 > CustomerMailer.test.deliver
Net::SMTPAuthenticationError: 503 5.5.1 Error: authentication not enabled
Any solution, guys?
You're specifying authentication details. ActionMailer will accordingly use them.
Solution: Don't.
config.action_mailer.smtp_settings = {
address: 'mail.example.com',
port: 587,
domain: 'info.example.com'
}
(The domain
parameter may itself be unnecessary depending on your server configuration.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With