@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 = 'abcd@gmail.com' in my emailer.rb and :user_name => "wxyz@gmail.com" in my environment.rb file. When i receive mail, from id is "wxyz@gmail.com" not "abcd@gmail.com". When its not gmail and port is 25 its works fine.

class Emailer < ActionMailer::Base   def sendmail(subject, email, sent_at, name, message)     @from = 'abcd@gmail.com'     @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 => "wxyz@gmail.com",     :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.