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:    localhost localhost.localdomain wschrep-Latitude-E6520

# Disable dns checks in sendmail config file /etc/mail/ add this line:

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=>"" }
  ActionMailer::Base.delivery_method = :sendmail
#  ActionMailer::Base.sendmail_settings = { 
#    :location       => '/usr/lib/sendmail',
#    :arguments      => '-i -t' 
#  }

Back to archive