Wednesday, August 8, 2012

[Rails] ActionMailer problem

Hi guys!

I used action mailer in my project,in that the from ID show always my own ID.I need it show some default ID like.,from@gmail.com

Here my coding,

In my set_mailer.rb

ActionMailer::Base.smtp_settings = {
  :address              => "smtp.gmail.com",
  :port                 => 587,
  :domain               => "gmail.com",
  :user_name            => "My_personal_ID",
  :password             => "********",
  :authentication       => "plain",
  :enable_starttls_auto => true
}

Here my mailer code:

class EmployeeMailer < ActionMailer::Base
  default from: "from@shriramits.com"
  def employee_creation(user)
    @employee=user
    attachments["logo.png"] = File.read("#{Rails.root}/app/assets/images/logo.png")
    mail(:to => user.eamil, :subject => "Registered") 
  end
end

Please give the solution...!!

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/RdBJayqjQLsJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate