From edc17dddb39d916769f110602b15c31d2947dd30 Mon Sep 17 00:00:00 2001 From: riking Date: Sun, 22 Jun 2014 15:04:24 -0700 Subject: [PATCH] Let's see if this works --- app/jobs/scheduled/poll_mailbox.rb | 4 ++++ app/mailers/rejection_mailer.rb | 8 ++++---- config/locales/server.en.yml | 4 ++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/app/jobs/scheduled/poll_mailbox.rb b/app/jobs/scheduled/poll_mailbox.rb index e0f4c852a87..e1f16113976 100644 --- a/app/jobs/scheduled/poll_mailbox.rb +++ b/app/jobs/scheduled/poll_mailbox.rb @@ -28,6 +28,10 @@ module Jobs client_message = RejectionMailer.send_trust_level(message.from, message.body) Email::Sender.new(client_message, :email_reject_trust_level).send rescue Email::Receiver::ProcessingError => e + Rails.logger.error e + message = Mail::Message.new(mail_string) + client_message = RejectionMailer.send_rejection(message.from, message.body, e.message) + # inform admins about the error data = { limit_once_per: false, message_params: { source: mail, error: e }} GroupMessage.create(Group[:admins].name, :email_error_notification, data) diff --git a/app/mailers/rejection_mailer.rb b/app/mailers/rejection_mailer.rb index 754e51c214c..0bf9e2b6a98 100644 --- a/app/mailers/rejection_mailer.rb +++ b/app/mailers/rejection_mailer.rb @@ -3,11 +3,11 @@ require_dependency 'email/message_builder' class RejectionMailer < ActionMailer::Base include Email::BuildEmailHelper - def send_rejection(from, body) - build_email(from, template: 'email_error_notification', from: from, body: body) + def send_rejection(from, body, error) + build_email(from, template: 'email_error_notification', error: "#{error.message}\n\n#{error.backtrace.join("\n")}", source: body) end - def send_trust_level(from, body, to) - build_email(from, template: 'email_reject_trust_level', to: to) + def send_trust_level(from, body) + build_email(from, template: 'email_reject_trust_level') end end diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index 4795c82ba89..860627621c6 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -1306,6 +1306,10 @@ en: `%{error}` + The original message follows. + + --- + %{source} email_reject_trust_level: