Very Small Hints for ActionMailer

Hi, I lost some hours to figure out, what the problems were to make sending via smtp working.

Here is a list you should check if something does not work:

  1. To enable raising exceptions during email sending make sure you add the following line into environment.rb:
    config.action_mailer.raise_delivery_errors = true
    Or put it into the test.rb or development.rb which will overwrite the settings specified in environment.rb
  2. Enable real email sending in test environment is possible in test.rb via
    config.action_mailer.delivery_method = :smtp
    instead of
    config.action_mailer.delivery_method = :test
    or directly use the following line in the test code
    ActionMailer::Base.delivery_method = :smtp
  3. if you get for your yahoo accout sth. like: EOFError: end of file reached.
    Or for your gmx account:
    Net::SMTPFatalError: 550 5.1.7 This server does not accept an empty envelope from ( ) {mp038}
    You should check that the ‘from’ property is really only the email not anything else! (See the next point)
  4. If you use the restful_authentication plugin you can use the following code in user_mailer.rb:

    def setup_email(user,subj=nil)
    recipients  “#{}”
    from        “#{FROM_EMAIL}”
    subject     “[#{SITE}] #{subj}”
    body        :user => user

    In environment.rb directly after the rails gem version constant add:

    SITE = ‘’
    FROM_EMAIL = ‘’

    And in the ‘ do |config|’ block do:

    config.action_mailer.default_charset = “utf-8”
    config.action_mailer.delivery_method = :smtp
    config.action_mailer.smtp_settings = {
    :address => “” ,
    :port => 25,
    :domain => “localhost” ,
    :authentication => :login,
    :user_name => FROM_EMAIL ,
    :password => “donotshare”


One thought on “Very Small Hints for ActionMailer

Comments are closed.