mardi 23 février 2016

Mail sent twice or more instead of once using rails 3.2

I am working with rails 3.2 and ruby 2.1.2p95. Through my application, sending 1000+ of emails. I want to send few email from smtp and few emails from sendgrid. So I have configured like below in Notifier.rb file

after_filter :set_delivery_options, :except => [:method1]

def set_delivery_options message.delivery_method.settings.merge!(:address => "smtp.gmail.com", :port => 587, :domain => "xxxxxxxx", :user_name => "xxxxxxxxxxxxx", :password => "xxxxxxxxxxxxx", :authentication => "plain", :enable_starttls_auto => true) end

My method is like below:

def method1(customer) mail( :to => customer.user.email, :subject => "Testing", #:bcc => EMAIL_BCC, :content_type => "text/html" ) end

Whenever I call the above method, the mail is sending twice or more in some times on production server.

Aucun commentaire:

Enregistrer un commentaire