roundcube: "Authentication failure: STARTTLS failed" when trying to send mail

Solution 1:

When you set $config['smtp_server'] with an URL that starts with tls://, you're setting up a PHP SSL context. As suggested by the default roundcube config, you may need to set options on the context.

In my case, I had to provide:

  • peer_name, the mail server's domain name.
  • cafile, the CA file path.

You can put the following in your Roundcube config.inc.php file:

$config['smtp_conn_options'] = [
  'ssl' => [
    'peer_name' => 'mail.example.com',
    'cafile' => '/etc/ssl/certs/ca-certificates.crt'
  ],
];