Home > Features, General > Action Mailer: All mail comes from MAILER DAEMON

Action Mailer: All mail comes from MAILER DAEMON

June 20th, 2007

Today I was trying to send mail from my Rails application through Action Mailer. This is quite simple, but I wanted to use a custom from-address. So, I create a setup_email method in my UserNotifier class that sets some defaults for every email sent out:

class UserNotifier < ActionMailer::Base
  protected
    def setup_email(user)
      @recipients  = "#{user.email}"
      @from        = "My Application <no-reply@example.com">
    end
end</no-reply@example.com">

May you spotted the problem already, but I didn’t. All the mail sent came from “MAILER DAEMON”.

From: MAILER DAEMON

The problem was that @from didn’t contain a properly formated from-address. It is missing the closing >, and so my email server ignores it.

If you have this issue, double check the from address, and make sure it’s valid! Cheers.

Please share the love of this post by bookmarking it, and sharing it with others. Thanks!

  • Digg
  • del.icio.us
  • description
  • Reddit
  • Facebook
  • E-mail this story to a friend!
  • TwitThis

,

  1. No comments yet.
  1. No trackbacks yet.