I have a little custom-made Node SMTP-server running on localhost, to assist with sending mails. But when I try sending a mail, I get these errors:
In Symfony:
{
"message": "Warning: stream_socket_enable_crypto(): SSL operation failed with code 1.
OpenSSL Error messages:\nerror:1416F086:SSL
routines:tls_process_server_certificate:certificate verify failed"
}
On my Node SMTP-server:
my-custom-smtp-server |
{
"level":30,
"time":1668095669283,
"pid":7,
"hostname":"1f08bad45913",
"msg":"Got connection from 172.22.0.1"
}
my-custom-smtp-server |
{
"level":50,
"time":1668095669294,
"pid":7,
"hostname":"1f08bad45913",
"msg":"SMTP Error 140413503703424:error:14094418:SSL routines:ssl3_read_bytes:tlsv1 alert
unknown ca:../deps/openssl/openssl/ssl/record/rec_layer_s3.c:1545:SSL alert number 48\n"
}
my-custom-smtp-server |
{
"level":50,
"time":1668095669294,
"pid":7,
"hostname":"1f08bad45913",
"msg":"SMTP Error 140413503703424:error:14094418:SSL routines:ssl3_read_bytes:tlsv1
alert unknown ca:../deps/openssl/openssl/ssl/record/rec_layer_s3.c:1545:SSL
alert number 48\n"}
Can I bypass this error somehow?
I'm trying to avoid having to setup TLS and SSL on my little mini Node-SMTP-server.
Contents of config/packages/dev/mailer.yaml
:
dsn: 'smtp://mydemo:mysuperpassword@host.docker.internal:2525'
Versions and specs
- Mac
- Symfony version 4.4
Attempted solution 1: Adding ?verify_peer=false
to the DSN
I tried making the DSN-line into this (found here and here):
dsn: 'smtp://mydemo:mysuperpassword@host.docker.internal:2525?verify_peer=false'
I also tried:
dsn: 'smtp://mydemo:mysuperpassword@host.docker.internal:2525?verify_peer=0'
But I get same error for both.
Attempted solution 2: Play around with network settings
I could read here: [Trying to access host.docker.internal results in Connection refused](https://github.com/docker/for-win/issues/2402#issuecomment-441059035] that it could be something with the host-file. However I can't find any of that in my host-file inside my container: docker-compose exec php bash
and then vim /etc/hosts
.
That was a post on docker-for-windows, though.
Attempted solution 3: Try sending a mail via cURL (from inside container)
I tried to access my PHP-container (docker-compose exec php bash
) and then send a mail with this command:
curl smtp://mydemo:mysuperpassword@host.docker.internal:2525 --mail-from myemail@example.org --mail-rcpt myemail@example.org --upload-file ~/email-example.txt
Where ~/email-example.txt
looked like this:
From: MyTry <myemail@example.org>
To: destinationaddress@example.org
Subject: Example email
Date: Mon, 7 Nov 2016 08:45:16
Dear Joe,
Welcome to this example email. What a lovely day.
And that worked! But sadly it just proves that the two containers can reach each other. And that my SMTP-server works. It doesn't solve the error I'm getting when trying to send a mail, via my SMTP-server, from the Symfony-application.