this is getting frusterating
This commit is contained in:
parent
3845010be6
commit
3f184c4dae
1 changed files with 9 additions and 6 deletions
|
|
@ -29,6 +29,7 @@ module Messagebus
|
||||||
@client.send_common_info = {:fromEmail => message.from.first, :customHeaders => {"sender"=> message['from'].to_s}}
|
@client.send_common_info = {:fromEmail => message.from.first, :customHeaders => {"sender"=> message['from'].to_s}}
|
||||||
message.to.each do |addressee|
|
message.to.each do |addressee|
|
||||||
m = {:toEmail => addressee, :subject => message.subject, :fromName => message_parse(message['from'].to_s)}
|
m = {:toEmail => addressee, :subject => message.subject, :fromName => message_parse(message['from'].to_s)}
|
||||||
|
@things = []
|
||||||
|
|
||||||
if message.multipart?
|
if message.multipart?
|
||||||
m[:plaintextBody] = message.text_part.body.to_s if message.text_part
|
m[:plaintextBody] = message.text_part.body.to_s if message.text_part
|
||||||
|
|
@ -38,12 +39,14 @@ module Messagebus
|
||||||
m[:htmlBody] = message.body.to_s
|
m[:htmlBody] = message.body.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
begin
|
|
||||||
@client.add_message(m)
|
@client.add_message(m)
|
||||||
|
@things << m
|
||||||
|
end
|
||||||
|
begin
|
||||||
status = @client.flush
|
status = @client.flush
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
raise "Message bus error with email #{e.message}: #{m[:toEmail]}, #{m[:fromName]}, #{m[:fromEmail]}"
|
raise "message bus failure: #{e.message} #{@things.map{|x| x[:fromEmail]}.inspect}"
|
||||||
end
|
|
||||||
end
|
end
|
||||||
if status[:failureCount] && status[:failureCount] > 0
|
if status[:failureCount] && status[:failureCount] > 0
|
||||||
raise "Messagebus failure. failureCount=#{failureCount}, message=#{message.inspect}"
|
raise "Messagebus failure. failureCount=#{failureCount}, message=#{message.inspect}"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue