Add email_sent callback function for newer orbit kernel.
This commit is contained in:
parent
82c4b8b24b
commit
f2e2563d45
|
@ -43,4 +43,11 @@ class PaperCriteria
|
|||
_email_sentdate
|
||||
end
|
||||
|
||||
def email_sent(mails, flag)
|
||||
unless flag
|
||||
self.send_failed_emails += mails
|
||||
self.send_failed_emails.uniq!
|
||||
self.save
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -49,7 +49,7 @@ namespace :epaper do
|
|||
emails_valid.each_slice(mail_limit).each do |slice_emails|
|
||||
invalid_mails = epaper_verify_email(from_addr,slice_emails,tls)
|
||||
deliver_emails = slice_emails - invalid_mails
|
||||
email = Email.new(:mail_subject => paper.sending_title, :mail_lang => args[:locale], :template => "admin/e_paper_criterias/emailer", :template_data => {"paper_id" => paper.id, "page" => "http://" + domain + page, "siteurl" => "http://" + domain, "papers_data" => papers_data }, :mail_to => deliver_emails, :module_app_key=>'e_paper', :mail_sentdate=> email_sentdate)
|
||||
email = Email.new(:mail_subject => paper.sending_title, :mail_lang => args[:locale], :template => "admin/e_paper_criterias/emailer", :template_data => {"paper_id" => paper.id, "page" => "http://" + domain + page, "siteurl" => "http://" + domain, "papers_data" => papers_data, "model_class" => "PaperCriteria", "model_id" => paper.id }, :mail_to => deliver_emails, :module_app_key=>'e_paper', :mail_sentdate=> email_sentdate)
|
||||
begin
|
||||
email.save
|
||||
if email_sentdate
|
||||
|
@ -65,7 +65,7 @@ namespace :epaper do
|
|||
error_flag = 0
|
||||
begin
|
||||
invalid_mails.each do |invalid_mail|
|
||||
email = Email.create(:mail_subject => paper.sending_title, :mail_lang => args[:locale], :template => "admin/e_paper_criterias/emailer", :template_data => {"paper_id" => paper.id, "page" => "http://" + domain + page, "siteurl" => "http://" + domain, "papers_data" => papers_data }, :mail_to => invalid_mail, :module_app_key=>'e_paper', :mail_sentdate=> email_sentdate)
|
||||
email = Email.create(:mail_subject => paper.sending_title, :mail_lang => args[:locale], :template => "admin/e_paper_criterias/emailer", :template_data => {"paper_id" => paper.id, "page" => "http://" + domain + page, "siteurl" => "http://" + domain, "papers_data" => papers_data, "model_class" => "PaperCriteria", "model_id" => paper.id }, :mail_to => invalid_mail, :module_app_key=>'e_paper', :mail_sentdate=> email_sentdate)
|
||||
end
|
||||
rescue => e
|
||||
puts [e,e.backtrace]
|
||||
|
|
Loading…
Reference in New Issue