So you are having a networking problem in the container, but it stems from DNS not IP connectivity.
Are you able to connect using openssl s_client
to the hostname from inside the container?
You should be able to run:
openssl s_client -connect smtp-relay.brevo.com:587 -starttls smtp
and get:
…
Verify return code: 0 (ok)
…
That’s expected since you’re connecting to an IP address and that IP address won’t be on the cert.
It will.