lib/mailkick/url_helper.rb in mailkick-1.2.2 vs lib/mailkick/url_helper.rb in mailkick-1.3.0
- old
+ new
@@ -1,8 +1,13 @@
module Mailkick
module UrlHelper
def mailkick_unsubscribe_url(subscriber, list, **options)
token = Mailkick.generate_token(subscriber, list)
- mailkick.unsubscribe_subscription_url(token, **options)
+ url = mailkick.unsubscribe_subscription_url(token, **options)
+ if Mailkick.headers && headers["List-Unsubscribe"].nil?
+ headers["List-Unsubscribe-Post"] ||= "List-Unsubscribe=One-Click"
+ headers["List-Unsubscribe"] = "<#{url}>"
+ end
+ url
end
end
end