We’d like to see how long it takes for a Mailer object to leave our
server after the deliver command is sent. How could we do this? We’d
like to get an accurate value (e.g. in milliseconds).
Wrap the call to your deliver_xxx method in Benchmark.realtime. This
will of course only measure the time it takes to generate the mail
object and until it is handed off to the mail server.
Since mails can be temporarily rejected multiple times (e.g.
greylisting, full mailboxes etc.) you’ll have to analyze your mailserver
logs if you want to look at those times as well.
We were using Sendmail to send e-mail from our app, but Sendmail had
the problem that it took too long to send some e-mails. So we switched
to Postfix, which is quite a bit faster and more accurate. However,
we’re still using :sendmail as our delivery_method. It works, but
could SMTP be faster?
Conventional wisdom says that bulk mailings should be done via SMTP
instead of local delivery, but I’ve had the opposite experience with
Postfix; here delivery via :sendmail to a mailserver running on the same
machine was a lot faster than using :smtp. Your mileage may vary
according to server hardware, mail type, size and the amount of mails
that are being sent at once.
Also, is there any way to prioritize Mailer objects? We’d like some e-
mails to go out immediatly and some can be added to the end of the
That is something you’ll have to configure in your mail server. AFAIK
Postfix doesn’t have a prioritization built in. You might want to
consider using different postfix instances to implement that kind of