Forum: Ruby on Rails Sender Email

6983e7aaea82078286d067a9d4e688d4?d=identicon&s=25 Daynthan Kabilan (Guest)
on 2014-02-14 12:13
(Received via mailing list)
Hi Friends,

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

*example*
mail(:to => user.email, :subject => "Thank you.", :from =>
"abc@gmail.com")
B1994475d62550dfb65f2f802fd48e79?d=identicon&s=25 James Davis, PhD (Guest)
on 2014-02-14 16:19
(Received via mailing list)
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 =>
"a...@gmail.com<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
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2014-02-14 19:06
(Received via mailing list)
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
6983e7aaea82078286d067a9d4e688d4?d=identicon&s=25 Daynthan Kabilan (Guest)
on 2014-02-17 06:32
(Received via mailing list)
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 Cheung <
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.