I operate a Rails application (a Discourse forum) that needs to send out email. My sysadmin told me I shouldn't use a specific outgoing mailserver, but rather specify my domain and have my app lookup the MX record for my domain — just as Postfix does with
relayhost = $mydomain. In particular, there's no mailserver that's always guaranteed to be online — here only my domain's MX records are maintained up-to-date.
But Rails email API doesn't support this, because that's doing it wrong. Indeed, I've found no suggestion to do that, and the argument seems sound, but I've seen nothing saying "don't do it", and Postfix supports this by default. OTOH, apparently MSMTP and Exim (Exim redirect to smart host based on mx record) don't support it.
- What is the correct behavior here? Is postfix being overly generous?
- Since I have a local Postfix server using the MX records, how bad would it if the Rails app would send email to Postfix?
EDIT: I didn't have this "local Postfix server", just MSMTP; I was asked to switch to the more complex Postfix just to get support for MX records. (And I might like to switch back, frankly, should this be fixed).
EDIT 2: I operate the application, I'm not writing it. More importantly, I've been asked to hand the email off to the relay servers of my domain through the MX record of my domain (I've clarified a bit above), not to implement a mail server — unless you count doing an MX lookup as "a mail server" (which is maybe correct).