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:


$ hostname

# 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(`DONT_PROBE_INTERFACES',`true')

Finally restart sendmail:


sudo /etc/init.d/sendmail restart

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