mirror of
https://github.com/neocities/neocities.git
synced 2025-07-23 19:10:40 +02:00
easy unsubscribe baked into emails
This commit is contained in:
parent
39ce179d16
commit
be0267956b
6 changed files with 91 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue