Reputation: 315
I have a Rails 4 based project with many mailers. Different mailers sents emails with different sender's email addresses.
How can I found sender's email address to use it in mail template? For example, I just want to get next code working:
inside mailers' view:
This mail sent from <%= message.sender.first %>!
I found that 'message' object present not in all emails. So, where I can get it?
Thanks!
Upvotes: 0
Views: 228
Reputation: 3048
Pass the sender to the mailer during the initialization, then in mailer assign sender to a instance variable and you will have sender available in your mailer view. Check out the Rails mailer guide for more info: http://guides.rubyonrails.org/action_mailer_basics.html
Upvotes: 1