I'm trying to send Drupal 8 emails using Swift Mailer (5.4.8, 8.x-1.0-beta1) and a remote SMTP server. The transport should be encrypted, so TLS should be used. This is my setting:

enter image description here

Unfortunatly when trying to send an email I'm getting a warning:

Warning: no valid certs found cafile stream: `/etc/apache2/ssl/certs/' in Swift_Transport_StreamBuffer->startTLS() [...]

And this error afterwards:

Unable to connect with TLS encryption

Without the encryption I'm able to send mails using the remote STMP server.

A test of the connection using TLS from the server where Drupal is installed looks fine (I guess):

openssl s_client -connect mail.example.com:25 -starttls smtp

The response (excerpt):

No client certificate CA names sent
SSL handshake has read 4369 bytes and written 586 bytes

So where do I get further details about the connection error? And what could be the cause of the problem?

  • 1
    I'm not an expert on email, but are you sure 25 is the correct port? On most mail hosts I've used, the encrypted port is 465, and 25 is unencrypted. – Patrick Kenny Oct 6 '17 at 8:08
  • You probably need to configure location of the cacert.pem via curl.cainfo = "C:\www\cacert.pem" and openssl.cafile = "C:\www\cacert.pem" in your php.ini if you are on localhost. Also even with this I had issues with ssl for abotu a year since something got broken in git for win(im on windows) so i always have to disable ssl validation. But if this is happening on server, something else is probably wrong. – user21641 Oct 6 '17 at 9:50
  • Also you can download the file here curl.haxx.se/docs/caextract.html – user21641 Oct 6 '17 at 9:51
  • @PatrickKenny: I'm pretty sure that the port should be 25. I get an timeout error, when using port 465. – Philipp Michael Oct 9 '17 at 14:05
  • @IvanJaros According to the watchdog log the valid cert should be in /etc/apache2/ssl/certs/. But although the pem-file has been downloaded to this directory and restarted apache, I still get the same warning and error. – Philipp Michael Oct 9 '17 at 14:08

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.