From 4cd90e17199e492160257d357916481018e4a047 Mon Sep 17 00:00:00 2001 From: Yuri Rudman Date: Fri, 9 Mar 2018 13:32:43 -0500 Subject: [PATCH 1/2] After sending e-mail with attached report we are deletting record in BinaryBlob table. So, after dividing recipients sending e-mail will work only for first group of resipient, attempt to send attached report for second group will throw [Couldn't find BinaryBlob...] error. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1547846 --- app/models/miq_report/notification.rb | 36 +++++++-------------------- 1 file changed, 9 insertions(+), 27 deletions(-) diff --git a/app/models/miq_report/notification.rb b/app/models/miq_report/notification.rb index de5f1ba80f6..cbc8f9ab219 100644 --- a/app/models/miq_report/notification.rb +++ b/app/models/miq_report/notification.rb @@ -43,34 +43,16 @@ def notify_user_of_report(run_on, result, options) end end - # Avoid ActionMailer bug where the email headers get corrupted when the total length in bytes of all the recipients exceeds approx 150 bytes. - # When this happens, the addresses on the end spill over into the headers and cause the content and mime information to be ignored. - # - # Split recipient list into groups whose total length in bytes is around 100 bytes or the configured limit - cut_off = ::Settings.smtp.recipient_address_byte_limit - sub_group = [] - grouped_tos = to.uniq.inject([]) do |g, t| - sub_group << t - if sub_group.join.length >= cut_off || to.index(t) == (to.length - 1) - g << sub_group - sub_group = [] - end - g - end - # - begin - grouped_tos.each do |group_of_tos| - _log.info("Queuing email user: [#{user.name}] report results: [#{result.name}] to: #{group_of_tos.inspect}") - options = { - :to => group_of_tos, - :from => from, - :subject => subject, - :body => body, - :attachment => attachments, - } - GenericMailer.deliver_queue(:generic_notification, options) - end + _log.info("Queuing email user: [#{user.name}] report results: [#{result.name}] to: #{to.inspect}") + options = { + :to => to, + :from => from, + :subject => subject, + :body => body, + :attachment => attachments, + } + GenericMailer.deliver_queue(:generic_notification, options) rescue => err _log.error("Queuing email user: [#{user.name}] report results: [#{result.name}] failed with error: [#{err.class.name}] [#{err}]") end From 258174f77ca638e8e40b6aba6444f6c1a7c912f2 Mon Sep 17 00:00:00 2001 From: Yuri Rudman Date: Fri, 9 Mar 2018 13:36:51 -0500 Subject: [PATCH 2/2] removed not used 'recipient_address_byte_limit' settings --- config/settings.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/config/settings.yml b/config/settings.yml index 94e42dac913..02ce0168038 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -1049,7 +1049,6 @@ :host: localhost :password: '' :port: '25' - :recipient_address_byte_limit: 100 :user_name: evmadmin :snapshots: :create_free_percent: 100