Sender Email

Hi Friends,

how to add current user’s email address for sender email using
actionmailer.

example
mail(:to => user.email, :subject => “Thank you.”, :from =>
[email protected]”)

On Friday, February 14, 2014 5:12:22 AM UTC-6, daynthan kabilan wrote:

Hi Friends,

how to add current user’s email address for sender email using
actionmailer.

example
mail(:to => user.email, :subject => “Thank you.”, :from =>
"[email protected]<javascript:>
")

Would you happen to be using Devise? If so, there is a current_user
helper for accessing the user that is currently logged in.

def thanks_message
mail to: user.email, subject: “Thank you.”, from: current_user.email

end

Al
On Friday, February 14, 2014 3:18:29 PM UTC, James Davis, PhD wrote:

def thanks_message
mail to: user.email, subject: “Thank you.”, from: current_user.email

end

Although do note that this may cause your messages to be flagged as
spam
(because most domains use DKIM/SPF to specify which mail servers are
authorized to send mail on their behalf, and in general you won’t be
authorized to send email from the user’s domain.

Fred

Thanks for your reply,

i want to add current user’s email address in our default :from in user
mailer

On Fri, Feb 14, 2014 at 11:35 PM, Frederick C. <