Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When users sign up to my site, the connection from my server to our 3rd-party SMTP provider is very bad and the app takes from a few seconds to a few minutes to connect. While it is trying to connect and send, users are forced to wait there and sometimes they would just give up and leave the site.

This is horrible user experience. What is a good way to make this seem instantaneous (having to host our own mailserver is not an option at this point)? Some way to execute this in the background? Maybe using some type of queuing mechanism?

I'm using the LNAMP stack on a CentOS 5 x64 machine. App is using CodeIgniter.


It seems using a local mailserver to use as a relay is a common solution. But how does one log or track whether or not email was delivered correctly by using this method?

Sidenote: Some ESPs provide a REST API for email delivery (ours do too). We currently use SMTP and not their REST API.

share|improve this question
up vote 1 down vote accepted

You can use Postfix as a nullmailer (relay only to ISP). This is nothing more than a four-liner:

myorigin = $mydomain
relayhost = $mydomain
inet_interfaces = loopback-only
local_transport = error:local delivery is disabled


share|improve this answer

Run a local sendmail/qmail/postfix - whatever, set the smtp server to localhost. The local MTA will queue and deliver when it can (right away or at the next queue run).

On your system:

# yum -y install sendmail
# chkconfig sendmail on
# service sendmail start

shoudl suffice.

I know bubke about CodeIgniter, so I cant help you there.

share|improve this answer
using our own mailserver is not an option right now. BUT is it possible to use postfix/sendmail as a middle-man to relay the request to the 3rd-party SMTP service? If so, how well does it handle queuing and stuff if the connection take a long time? – lamp_scaler Oct 4 '11 at 15:49
I think you are right lamp_Scaler about using mail server as the middle man. Atleast the user experience is instantaneous. As to why connection is taking so long maybe your provider is at fault here. I suggest switching providers if possible or to pose this issue to them in their tech support. – Vangel Oct 4 '11 at 15:53
@lamp_scaler It's definitely possible to use Postfix, Sendmail, or any other MTA worth its salt. With Postfix you'd just set relayhost ( to your provider. – Gerald Combs Oct 4 '11 at 15:56
A relay-only mail server is a very common configuration and can be done with about every SMTP server. The likes of Postfix/Sendmail/Exim are a little bit of overkill though (IMHO), but there are specialized relay-only servers available (like nullmailer). Anyway, they handle the queuing etc. all alone, you just drop your mails to the queue and they do the rest (but your app will not know if the delivery ultimately failed). – Sven Oct 4 '11 at 15:57
Yea...My app actually keeps a log if a connection or sending failed through my ESP. But with the relay, is there a way to capture failure events and log them? – lamp_scaler Oct 4 '11 at 16:01

Not sure how common it (good practise) is but sending an email is a typical asynchronous process. One that can take several seconds and beyond. This makes it a perfect candidate for the use of messaging queue.

The delivery method is of secondary importance but third party providers such as SendGrid (for transactional emails - forgotten password, invoice etc) or MailChimp (for newsletters and marketing) offer good value and has proven reliable.

By messaging queue I mean RabbitMQ (AMQ), ZeroMQ, Gearman, AWS SQS etc Those can be used for any sort of information exchange between applications. In this case it's an information that certain email needs sending.

In terms of delivery information this can be obtained through an API with such provider or with more expensive plans through callback.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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