2

When sending my e-mail I get

550 Sender verify failed (Net::SMTPFatalError)

This is what my smtp_setting looks like:

  config.action_mailer.delivery_method = :smtp
  config.action_mailer.default_url_options = { host: 'MIIP' }
  config.action_mailer.smtp_settings = {
    address: 'myadress.com,
    user_name: 'noreply@myadresswerk.com',
    password: 'password'
    port: 587,
    ssl_context_starttls: OpenSSL::SSL::SSLContext.new.tap do |ctx|
      ctx.verify_mode = OpenSSL::SSL::VERIFY_NONE
    end,
    authentication: :login,
    openssl_verify_mode: 'none'
  }

However, if I execute the following in the rails console, the mail dispatch works

smtp = Net::SMTP.new('myaddr.com', 587)
smtp.start('localhost', 'noreply@myaddr.com', 'password', :login) do |smtp|
smtp.send_message 'Hello world!', 'noreply@myaddr.com', 'receiver@gmail.com'
end

Additional config:

OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE

If this is not set, I get

SSL_connect returned=1 errno=0 state=error: certificate verify failed (hostname mismatch) (OpenSSL::SSL::SSLError)

Defined the smtp_settings after the Net::SMTP if possible, I'm probably missing something.

faa_q
  • 21
  • 1

0 Answers0