Email delivery using TLS to the gmails and hotmails of this world #101
Replies: 5 comments 3 replies
-
So I tried the first option with the following config: [queue.strategy]
tls = [ { if = "retry_num > 0", then = "'disabled'" },
{ else = "'enabled'" } ]
[queue.tls.disabled]
starttls = "disable"
mta-sts = "disable"
dane = "disable"
[queue.tls.enabled]
allow-invalid-certs = false
starttls = "require"
mta-sts = "optional"
dane = "optional" Then sending an email to a gmail address gave the following errors on the first attempt:
And the same errors on the second and third attempt, so this didn't work. It seems the if = "retry_num > 0" is getting ignored. |
Beta Was this translation helpful? Give feedback.
-
Then tried option 3 with the following config: [queue.strategy]
tls = [ { if = "eq_ignore_case('gmail.com', rcpt_domain)", then = "'no-tls'" },
{ if = "eq_ignore_case('hotmail.com', rcpt_domain)", then = "'no-tls'" },
{ if = "eq_ignore_case('icloud.com', rcpt_domain)", then = "'no-tls'" },
{ else = "'default'" } ]
[queue.tls.no-tls]
starttls = "disable"
mta-sts = "disable"
dane = "disable"
[queue.tls.default]
allow-invalid-certs = false
starttls = "require"
mta-sts = "optional"
dane = "optional" Mails to all three domains were delivered successfully. But of course, sent over the wire in plain-text, not something really desirable. Anyone has any ideas how to do this right? |
Beta Was this translation helpful? Give feedback.
-
So I also tried option two with fallback, like this: [queue.strategy]
route = [ { if = "is_local_domain('', rcpt_domain)", then = "'local'" },
{ if = "retry_num > 0", then = "'relay'" },
{ else = "'mx'" } ]
[queue.route.local]
type = "local"
[queue.route.mx]
type = "mx"
[queue.route.relay]
type = "relay"
address = "<RELAY_SERVICE>"
port = 587
protocol = "smtp"
[queue.route.relay.auth]
username = "<USER_NAME>"
secret = "<SECRET>"
[queue.route.relay.tls]
implicit = false
[queue.strategy]
tls = "'default'"
[queue.tls.default]
allow-invalid-certs = false
starttls = "require"
mta-sts = "optional"
dane = "optional" And the relay does not get triggered, it keeps repeating the same error "STARTTLS unavailable". |
Beta Was this translation helpful? Give feedback.
-
As a temporary workaround, I will use the following config which seems to work for the recipient emails I've tested it with: [queue.strategy]
route = [ { if = "is_local_domain('', rcpt_domain)", then = "'local'" },
{ else = "'mx'" } ]
[queue.route.local]
type = "local"
[queue.route.mx]
type = "mx"
[queue.strategy]
tls = "'default'"
[queue.tls.default]
allow-invalid-certs = false
starttls = "disable"
mta-sts = "optional"
dane = "optional" If that gives a lot of other errors, then I'll switch to always using a relay service. I really hope for a better solution, and to understand why the "retry_num > 0" doesn't work. |
Beta Was this translation helpful? Give feedback.
-
Perhaps the errors you're getting are permanent and your message is not being retried at all? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I've been trying to set up outbound email delivery as secure as I can have it.
This has been challenging when mail is to be delivered to the big ones, like gmail and hotmail.
Delivery fails for these, with an error like 'STARTTLS not advertised by host'. I noticed delivery is always tried on port 25.
As far as I can see, my certificates are set up correctly and the outgoing traffic is working fine. Delivery does work for some lesser known domains, so I doubt that it is my server config.
When I disable TLS for these outgoing domains, the emails get delivered. I'm just hoping there is a better way.
What I could come up with so far, are these options:
Create a TLS strategy that tries with TLS on the first attempt, and disables TLS on subsequent attempts if the first one fails (I tried following the example in https://stalw.art/docs/mta/outbound/tls but that didn't work, it kept repeating with TLS. Maybe the last_error has a different value, but I'm not sure how to figure out what it was. Instead of checking for a specific error, I could check only if retry_num > 0)
Create a failover routing strategy that tries the normal mx route first and if that fails, use a relay service for delivery.
(maybe combine it with the one above, so it becomes a 3 step process)
Create an exception for every domains that has this issue and disable TLS when delivering to them (figuring it out one error at the time )
It is my understanding that these big ones should accept TLS when using a different port, like 587 or 465, but I haven't found a way to do this. It seems mx routing always uses port 25 by default. Is there any way to influence this or am I missing something?
Does anyone have a better idea or is it just the state of affairs when it comes to email delivery?
Also if you think I might have missed anything, please point it out!
Beta Was this translation helpful? Give feedback.
All reactions