lib/mailkick/processor.rb in mailkick-0.1.5 vs lib/mailkick/processor.rb in mailkick-0.1.6

- old
+ new

@@ -18,10 +18,12 @@ verifier = ActiveSupport::MessageVerifier.new(Mailkick.secret_token) token = verifier.generate([email, user.try(:id), user.try(:class).try(:name), list]) parts = message.parts.any? ? message.parts : [message] parts.each do |part| - part.body.raw_source.gsub!(/%7B%7BMAILKICK_TOKEN%7D%7D/, CGI.escape(token)) + if part.content_type.match(/text\/(html|plain)/) + part.body = part.body.decoded.gsub(/%7B%7BMAILKICK_TOKEN%7D%7D/, CGI.escape(token)) + end end end end end