Reputation: 7314
I can set a default from address in a rails like so;
class UserMailer < ActionMailer::Base
default :from => "\"Company\" <[email protected]>"
def custom_address(user)
# I want to set the from address here
mail(to: user.email, subject: 'Custom from address')
end
end
but how do I set a custom address for a different method? I can't see it listed anywhere in the docs
Upvotes: 0
Views: 50
Reputation: 1128
I may be wrong, but I believe you can just override the from within the mail method.
class UserMailer < ActionMailer::Base
default :from => "\"Company\" <[email protected]>"
def custom_address(user)
# I want to set the from address here
mail(to: user.email, subject: 'Custom from address', from: '[email protected]')
end
end
Upvotes: 1