lost connection after STARTTLS: Postfix

ActionMailer was changed to a more secure default configuration and checks the server certificate in TLS mode (since version 2-something or 3).

Some solutions are:

  • Restore the old Rails behaviour in the app: add openssl_verify_mode: 'none' to the Rails config
  • Disable TLS on the server: set smtpd_use_tls=no in your Postfix config
  • Set up valid TLS certificates on the server, which are verifiable using a certificate authority on the client (the Rails app). This is probably overkill if it's the same server as appears to be the case in this example, but for this kind of configuration you will want to make sure smtpd is not listening on a public port.

Perhaps the rails app doesn't trust the postfix certificate?