SMTP server configuration does not support MX lookups

Problem:
When configuring the “SMTP Address” under “Administer” - “Settings” - “Email”, I would like to use a domain name, rather than a SMTP Host address.
If “SMTP Address” is configured with a domain name, Foreman fails to send mails.

Expected outcome:
Foreman should recognize the domain name, look up MX records from DNS for the domain, and pick an SMTP host by observing MX priorities, as specified in DNS.
If one SMTP MX host is not available, it should try the next.
This is easier to configure and more robust in terms of mail delivery.

Foreman and Proxy versions:
3.5.1

Foreman and Proxy plugin versions:
Katello 4.7.1

Distribution and version:
Rocky Linux 8

Could someone please confirm that this feature does not exist?
If it doesn’t, would it make sense to request the feature?

Thanks

As far as I know this does not exist, but in most environments you need to configure an internal relay for the server to be allowed for mail delivery. This is why the current solution makes more sense to me and the lookup via MX record seems like are rare case. But nevertheless if it is an useful feature for you, please open an issue.

1 Like

No, I don’t think a mail client (aka mail user agent, even if the user here is an app) should lookup MX records. A mail transport agent (like Postfix or Sendmail) should. So if you’re configuring mail with SMTP, please enter the right SMTP server.

I second that. In particular because the MX DNS records point to MTAs and for mail submission you would need an MSA. Of course, you can mix everything into one server but generally, I think, it’s not a bad idea to separate the MX MTAs from the MSA because the MX MTAs have to accept mail from outside, while the MSA accept mails only from the inside or on authenticated connections.

In addition, I’ll recommend to use a local mail server to accept the mails and forward them. We have very stripped down null-client postfix running on the servers which accept the mails locally and then forward the mails to the relayhost/mailhost which handles the rest. That way, the foreman smtp client doesn’t have to handle delays/failures etc…