lib/mailkick/processor.rb in mailkick-0.0.2 vs lib/mailkick/processor.rb in mailkick-0.0.3
- old
+ new
@@ -7,12 +7,17 @@
end
def process
email = message.to.first
user = Mailkick.user_method.call(email) if Mailkick.user_method
+ list = message[:mailkick_list].try(:value)
+ if list
+ # remove header
+ message[:mailkick_list] = nil
+ end
verifier = ActiveSupport::MessageVerifier.new(Mailkick.secret_token)
- token = verifier.generate([email, user.try(:id), user.try(:class).try(:name)])
+ 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/, token)
end