Fix bug.
This commit is contained in:
parent
f64b643c99
commit
55b30b3dae
|
@ -56,7 +56,7 @@ def initialize
|
|||
|
||||
def send_newsletter
|
||||
Orbit::Application.load_tasks
|
||||
rake = Rake::Task['epaper:send_email'].execute(OpenStruct.new({:paper_criteria_id => params[:id], :domain => request.host_with_port, :locale => I18n.locale}))
|
||||
rake = Rake::Task['epaper:send_email'].execute(OpenStruct.new({:paper_criteria_id => params[:id], :domain => request.host_with_port, :locale => I18n.locale.to_s}))
|
||||
# rake = Rake::Task['epaper:send_email'].invoke([params[:id], request.host_with_port])
|
||||
paper = PaperCriteria.find(params[:id]) rescue nil
|
||||
if !paper.nil? && paper.invalid_emails.blank?
|
||||
|
|
|
@ -25,6 +25,7 @@ namespace :epaper do
|
|||
emails_valid.each_slice(mail_limit).each do |slice_emails|
|
||||
email = Email.new(:mail_subject => paper.sending_title, :mail_lang => args[:locale], :template => "admin/e_paper_criterias/emailer", :template_data => {"paper" => paper, "page" => "http://" + domain + page, "siteurl" => "http://" + domain, "papers_data" => papers_data }, :mail_to => slice_emails)
|
||||
begin
|
||||
email.save
|
||||
email.deliver
|
||||
puts "Sending #{slice_emails.count} emails"
|
||||
rescue => e
|
||||
|
|
Loading…
Reference in New Issue