Fixing slow sendmail

Written by Walter Schreppers

If your sendmail is taking 60 seconds to send emails out to the world (this happens on new ubuntu installs) here is the fix for that:


wschrep@wschrep-Latitude-E6520:~$ hostname
wschrep-Latitude-E6520


Now add a line to your /etc/hosts file:
127.0.0.1 localhost localhost.localdomain wschrep-Latitude-E6520

Disable dns checks in sendmail config file /etc/mail/sendmail.mc add this line:
define(`confDONT_PROBE_INTERFACES',`true')dnl


Finally restart sendmail:

wschrep@wschrep-Latitude-E6520:~$ sudo /etc/init.d/sendmail restart
* Restarting Mail Transport Agent (MTA) sendmail [ OK ]


Presto you can send emails within less than a second instead of 60+ seconds per mail ;).

In rails I have it setup like so:

config.action_mailer.default_url_options = { :host=>"mail.schreppers.com" }

ActionMailer::Base.delivery_method = :sendmail
# ActionMailer::Base.sendmail_settings = {
# :location => '/usr/lib/sendmail',
# :arguments => '-i -t'
# }

Back to archive