Forum: Ruby on Rails Sender Email

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
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")
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
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
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 <
This topic is locked and can not be replied to.