0

How do you configure Symfony Mailer? I'm swapping Swiftmailer to Symfony Mailer because Swiftmailer is now deprecated. However, I haven't been able to send a single email with Symfony Mailer yet. Swiftmailer always works and the emails are caught by smtp4dev.

Platform:

  • Windows 10
  • Symfony 4.4
  • smtp4dev listening on port 25

mailer.yaml

framework:
  mailer:
    dsn: 'smtp://localhost'

Error message:

stream_socket_enable_crypto(): SSL: An established connection was aborted by the software in your host machine.
CJ Dennis
  • 4,226
  • 2
  • 40
  • 69
  • Looks like [TLS Verification](https://symfony.com/doc/current/mailer.html#tls-peer-verification). Try with `dsn: 'smtp://localhost?verify_peer=0'`. – Bossman Sep 15 '22 at 09:40
  • @Bossman That made no difference. Are these options documented somewhere? – CJ Dennis Sep 15 '22 at 09:50
  • There is a link in my comment, that page is the docs for the mailer and specifically for the *verify_peer* option. From the error message it looks like it might be the local server software blocking it, like XAMPP for example or whatever you're using.. – Bossman Sep 15 '22 at 10:02
  • 1
    [This may be of help also](https://stackoverflow.com/questions/30556773/how-to-fix-stream-socket-enable-crypto-ssl-operation-failed-with-code-1). It's a cert issue somewhere.. – Bossman Sep 15 '22 at 10:08
  • @Bossman There's no mention of "TLS" on the 4.4 page. Does smtp have certificates? And on `localhost`? – CJ Dennis Sep 15 '22 at 10:26
  • I think the Symfony mailer component has the checks. Yes smtp has certs, you can generate localhost certs. Like i say from the error it looks like your server software might have settings to point to certs maybe, not 100% sure.. – Bossman Sep 15 '22 at 10:33
  • @Bossman Wouldn't that be smtps (465), not smtp (25)? Why would it need a certificate if it's not secure? – CJ Dennis Sep 15 '22 at 23:24

0 Answers0