lib/govdelivery/tms/mail/delivery_method.rb in govdelivery-tms-0.8.5 vs lib/govdelivery/tms/mail/delivery_method.rb in govdelivery-tms-0.8.7

- old
+ new

@@ -26,16 +26,16 @@ def deliver!(mail) fail GovDelivery::TMS::Errors::NoRelation.new('email_messages', client) unless client.respond_to?(:email_messages) body = case - when mail.html_part - mail.html_part.body - when mail.text_part - mail.text_part.body - else - mail.body + when mail.html_part + mail.html_part.body + when mail.text_part + mail.text_part.body + else + mail.body end.decoded message_params = { subject: mail.subject, body: body @@ -43,11 +43,10 @@ message_params[:from_email] = mail.from.first unless mail.from.blank? message_params[:from_name] = mail[:from].display_names.first unless mail[:from].blank? tms_message = client.email_messages.build(message_params) - mail.to.each { |recip| tms_message.recipients.build(email: recip) } tms_message.post! tms_message end @@ -58,8 +57,8 @@ end end if defined?(ActionMailer) ActionMailer::Base.add_delivery_method :govdelivery_tms, GovDelivery::TMS::Mail::DeliveryMethod, auth_token: nil, - logger: ActionMailer::Base.logger, - api_root: GovDelivery::TMS::Client::DEFAULTS[:api_root] + logger: ActionMailer::Base.logger, + api_root: GovDelivery::TMS::Client::DEFAULTS[:api_root] end