From 123fa079b35f2af384c05833bea0ac4b584d9b56 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Sat, 11 Apr 2015 10:15:43 +0800 Subject: [PATCH] =?UTF-8?q?smtp=E9=85=8D=E7=BD=AE=E6=94=BE=E5=85=A5product?= =?UTF-8?q?ion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/mailer.rb | 12 ++++++------ config/configuration.yml | 12 ++++++++++-- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 39c38b269..a6acb1635 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -66,8 +66,8 @@ class Mailer < ActionMailer::Base subject = "[ #{user.show_name} : #{l(:label_day_mail)}]" @subject = " #{user.show_name} : #{date_to} #{l(:label_day_mail)}" - date_from = "#{date_from} 23:59:59" - date_to = "#{date_to} 23:59:59" + date_from = "#{date_from} 17:59:59" + date_to = "#{date_to} 17:59:59" # 生成token用于直接点击登录 @user = user @@ -122,11 +122,11 @@ class Mailer < ActionMailer::Base end end # 查询user在课程中发布的通知,项目中发的新闻 - @course_news = News.find_by_sql("select DISTINCT n.* from news n + @course_news = (course_ids && !course_ids.empty?) ? News.find_by_sql("select DISTINCT n.* from news n where n.course_id in (#{course_ids}) - and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc") - @project_news = News.find_by_sql("select DISTINCT n.* from news n where n.project_id in (#{project_ids}) - and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc") + and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc") : [] + @project_news = (project_ids && !project_ids.empty?) ? News.find_by_sql("select DISTINCT n.* from news n where n.project_id in (#{project_ids}) + and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc") : [] # 查询user在课程及个人中留言 @course_journal_messages = JournalsForMessage.find_by_sql("select DISTINCT * from journals_for_messages where diff --git a/config/configuration.yml b/config/configuration.yml index adfaea456..32eeb61a7 100644 --- a/config/configuration.yml +++ b/config/configuration.yml @@ -78,9 +78,8 @@ # http://wiki.rubyonrails.org/rails/pages/HowToSendEmailsWithActionMailer -# default configuration options for all environments + default: - # Outgoing emails configuration (see examples above) email_delivery: delivery_method: :smtp smtp_settings: @@ -203,6 +202,15 @@ default: production: # CJK support rmagick_font_path: /usr/share/fonts/ipa-mincho/ipam.ttf + email_delivery: + delivery_method: :smtp + smtp_settings: + address: mail.trustie.net + port: 25 + domain: mail.trustie.net + authentication: :login + user_name: "mail@trustie.net" + password: "loong2010" # specific configuration options for development environment # that overrides the default ones