header[:mailkick_list] does not work
krnjn opened this issue · comments
In the README you have stated that to create an unsubscribe link for a particular list to simply assign variable header[:mailkick_list]
with the desired list name. In looking at the docs, it looks like you may have updated that variable to message[:mailkick_list]
. Just thought it'd be a small thing to fix in the readme for other folks.
Also, for folks that may not have the rails routes automatically included into the mailers, I'd add a bit of documentation letting folks know that the unsubscribe urls can easily be called in templates after adding this to ApplicationMailer (or whatever mailer you're using):
class ApplicationMailer < ActionMailer::Base
...
include Rails.application.routes.url_helpers
def self.default_url_options
ActionMailer::Base.default_url_options
end
...
end
Hey @krnjn, message[:some_header]
reads the header of the message, so it should be correct.
Hm, @ankane not sure I follow actually. In the gem's documentation, you have listed:
class UserMailer < ActionMailer::Base
def order_reminder(user)
header[:mailkick_list] = "order_reminders"
# ...
end
end
Is that how we should be doing it or should it be message[:mailkick_list] = list_name
In the mailer, you should use header[:mailkick_list]
. Outside the mailer when dealing with the message, you'll need to use message[:mailkick_list]
.
Also, for me it was headers[:mailkick_list]
not header[:mailkick_list]
Yes it's "headers" not "header"
Thanks everyone for reporting. I've updated the docs with the correct method.