easy unsubscribe baked into emails

This commit is contained in:
Kyle Drake 2015-01-07 15:24:15 -08:00
parent 39ce179d16
commit be0267956b
6 changed files with 91 additions and 3 deletions

View file

@ -3,13 +3,17 @@ class EmailWorker
sidekiq_options queue: :emails, retry: 10, backtrace: true
def perform(args={})
unsubscribe_token = Site.email_unsubscribe_token args['to']
footer = "\n\n---\nYou are receiving this email because you have a Neocities site. If you would like to subscribe from Neocities emails, just visit this url:\nhttps://neocities.org/settings/unsubscribe_email?email=#{Rack::Utils.escape args['to']}&token=#{unsubscribe_token}"
Mail.deliver do
# TODO this is not doing UTF-8 properly.
from args['from']
reply_to args['reply_to']
to args['to']
subject args['subject']
body args['body']
body args['body']+footer
end
end
end