0

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.

  1. What is the correct behavior here? Is postfix being overly generous?
  2. 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).

6
  • 2
    Why reinvent the wheel? – Michael Hampton Jan 13 '16 at 3:03
  • Which choice is "reinventing the wheel" for you? Also having A records? Using the local Postfix server just for fancy MX lookup? – Blaisorblade Jan 13 '16 at 3:13
  • 4
    Anything other than passing it off to an SMTP server is reinventing the wheel. – Michael Hampton Jan 13 '16 at 3:16
  • Sorry, I've figured why I've been confusing: I have been asked to pass it off to an SMTP server through MX. – Blaisorblade Jan 13 '16 at 3:25
  • 5
    IMHO you should pass it to a local mail server and be done with it. If you have to look up MX records and deliver the email you're doing an email servers job. Suggest your sysadmin is incorrect. – Tim Jan 13 '16 at 3:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.