Set Return-Path in emails only if To is a String

This commit is contained in:
Patrick Gansterer 2017-10-09 11:47:27 +02:00
parent 8111e3cc59
commit 0b79fe4f41

View file

@ -94,7 +94,7 @@ class Mailer < ActionMailer::Base
end
reply_email_domain = FoodsoftConfig[:reply_email_domain]
if reply_email_domain && !args[:return_path]
if reply_email_domain && !args[:return_path] && args[:to].is_a?(String)
#TODO: Remove workaround for https://github.com/mikel/mail/issues/39 after next mail release
ascii_to = args[:to].encode('ASCII', invalid: :replace, undef: :replace, replace: '_')
address = Mail::Parsers::AddressListsParser.new.parse(ascii_to).addresses.first