diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-08-24 20:57:35 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-08-24 20:57:35 +0300 |
commit | 208888038375d48cc91cf481a3f8509d63d8e1ad (patch) | |
tree | ab3399fbda238d4763aa999e3919e59f07860a4f | |
parent | e449426a4e7d15cdd582d4f136add52cbfb5e04e (diff) |
Ignore empty incoming messages.
-rw-r--r-- | app/mailers/email_rejection_mailer.rb | 2 | ||||
-rw-r--r-- | app/workers/email_receiver_worker.rb | 2 | ||||
-rw-r--r-- | config/mail_room.yml.example | 2 | ||||
-rw-r--r-- | doc/reply_by_email/README.md | 4 |
4 files changed, 10 insertions, 0 deletions
diff --git a/app/mailers/email_rejection_mailer.rb b/app/mailers/email_rejection_mailer.rb index 89aceda82d1..883f1c73ad4 100644 --- a/app/mailers/email_rejection_mailer.rb +++ b/app/mailers/email_rejection_mailer.rb @@ -3,6 +3,8 @@ class EmailRejectionMailer < BaseMailer @reason = reason @original_message = Mail::Message.new(original_raw) + return unless @original_message.from + headers = { to: @original_message.from, subject: "[Rejected] #{@original_message.subject}" diff --git a/app/workers/email_receiver_worker.rb b/app/workers/email_receiver_worker.rb index a588a1f45ee..8cfb96ef376 100644 --- a/app/workers/email_receiver_worker.rb +++ b/app/workers/email_receiver_worker.rb @@ -18,6 +18,8 @@ class EmailReceiverWorker def handle_failure(raw, e) Rails.logger.warn("Email can not be processed: #{e}\n\n#{raw}") + return unless raw.present? + can_retry = false reason = nil diff --git a/config/mail_room.yml.example b/config/mail_room.yml.example index 28366eb7394..dd8edfc42eb 100644 --- a/config/mail_room.yml.example +++ b/config/mail_room.yml.example @@ -14,6 +14,8 @@ # :name: "inbox" # # Always "sidekiq". # :delivery_method: sidekiq + # # Always true. + # :delete_after_delivery: true # :delivery_options: # # The URL to the Redis server used by Sidekiq. Should match the URL in config/resque.yml. # :redis_url: redis://localhost:6379 diff --git a/doc/reply_by_email/README.md b/doc/reply_by_email/README.md index 91eea956e52..5d36f5121d1 100644 --- a/doc/reply_by_email/README.md +++ b/doc/reply_by_email/README.md @@ -59,6 +59,8 @@ In this example, we'll use the Gmail address `gitlab-replies@gmail.com`. If you' :name: "inbox" # Always "sidekiq". :delivery_method: sidekiq + # Always true. + :delete_after_delivery: true :delivery_options: # The URL to the Redis server used by Sidekiq. Should match the URL in config/resque.yml. :redis_url: redis://localhost:6379 @@ -144,6 +146,8 @@ TODO :name: "inbox" # Always "sidekiq". :delivery_method: sidekiq + # Always true. + :delete_after_delivery: true :delivery_options: # The URL to the Redis server used by Sidekiq. Should match the URL in config/resque.yml. :redis_url: redis://localhost:6379 |