@from in emailer.rb not working with rails + gmail

Hi All,

Am trying to send email through gmail in rails. Its working fine. My
issue is @from is not working. I have assigned @from = ‘[email protected]
in my emailer.rb and :user_name => “[email protected]” in my
environment.rb file. When i receive mail, from id is “[email protected]
not “[email protected]”. When its not gmail and port is 25 its works fine.

class Emailer < ActionMailer::Base
def sendmail(subject, email, sent_at, name, message)
@from = ‘[email protected]
@subject = subject
@recipients = email
@sent_on = sent_at
@body[“name”] = name
@body[“message”] = message
end
end

ActionMailer::Base.delivery_method = :smtp
require ‘smtp_tls’

ActionMailer::Base.smtp_settings = {
:address => “smtp.gmail.com”,
:port => 587,
:domain => “www.google.com”,
:user_name => “[email protected]”,
:password => “mypassword”,
:authentication => :plain
}

Thanks in advance :slight_smile:

Vipin

i believe gmail rewrites the from address to help prevent spam. you
can test this using outlook, thunderbird, etc.
i think they want you to set the reply to address.