This commit is contained in:
BoHung Chiu 2020-11-30 21:27:49 +08:00
parent f64b643c99
commit 55b30b3dae
2 changed files with 2 additions and 1 deletions

View File

@ -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?

View File

@ -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