![](/style/images/good.png)
![](/style/images/bad.png)
Action Mailer: All mail comes from MAILER DAEMON
source link: https://www.devroom.io/2007/06/20/action-mailer-all-mail-comes-from-mailer-daemon/?utm_campaign=Feed%3A+ariejan+%28ariejan%7Cdevroom.io%29
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Action Mailer: All mail comes from MAILER DAEMON
Posted:
2007-06-20
- Last updated:
2019-06-05
Tagged general rubyonrails features ruby
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 <[email protected]>">
end
end
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.
My site is free of ads and trackers. I record privacy-respecting usage statistics with Fathom.
Was this post helpful to you? Why not ☕ Buy me a coffee
Copyright © 1999-2020 Ariejan de Vroom <[email protected]>
Live now; make now always the most precious time. Now will never come again.
– Jean-Luc Picard
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK