so the question is, would it be "better" to run localhost mta (ie. postfix) or "better" to use 3rd party restful api, embedded in the application, to send email?

i am curious what people would do here.

i find postfix on linux allows much greater flexibility and control. the default sendmail/postfix logging (/var/log/maillog) suits me fine, and you can even set limits via iptables on per uuid's which allows rate-limiting apps.

  • 4
    I prefer to use a local MTA, if for no other reason than being able to having queuing handled by Postfix instead of having to rely on an external host, and/or implement queuing/retrying in the application. – fukawi2 Oct 18 '13 at 2:28
  • great point about postfix handling its own queue, as opposed to relying on 3rd party to do this. also, can anyone speak on high volume, as it relates to this and performance? thanks! – nandoP Oct 19 '13 at 0:52
  • 2
    I should mention that I always use a smarthost as well, so no need to manage anti-spam best practices on the app hosts etc. All it needs to do it queue and forward to smarthost, no worry about SPF, DKIM, PTR records etc. – fukawi2 Oct 20 '13 at 22:48
  • "Smarthost", is a postfix directive. (if i remember correctly, it bypasses postfix rules, and forwards smtp message to said "smarthost" for smtp relaying). This would suggest another vote for running postfix locally and having app relay thru localhoist:25 ? anyone have opinion about the two with regards to high volume? it is likely that localhost mta is better due to queue mgmt, as stated earlier (queue manip and retries)? ....is there any reason at all to run sendgrid api (boss would like to know)? – nandoP Oct 21 '13 at 14:38

There are pros and cons to each.

As, fukawi2 states using a local MTA with a smarthost (e.g. SendGrid, Mandril, etc.) gives you a whole lot of built in functionality (queueing, fallbacks, and more) with less configuration. Meaning you don't have to write it into the application yourself.

That said, using a web based mail sending API tends to be faster, as SMTP is a very chatty protocol, (but you need to write queueing and fallbacks yourself).

SendGrid's general recommendation is to use SMTP due to all the built in functionality of a local mail server. However, if speed/server load is more of a concern, Web API might be a better solution.

| improve this answer | |
  • Yeah, that's what I was trying to 'verbalize' ;) – fukawi2 Oct 21 '13 at 22:30
  • Yours was very salient. I figured I might as well summarize your points as an answer. – Nick Q. Oct 21 '13 at 22:32
  • i guess for our purposes, as speed is more important than having the devs work a little harder (two lines of auth code),... this is a solved issue. – nandoP Oct 26 '13 at 22:33
  • 1
    As of September 2016, Sendgrid's recommendation (at the link in this answer) is to use their web API in most cases, but they still SMTP and a local MTA in high-volume scenarios. – Michael Kopinsky Sep 19 '16 at 15:17

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.