How to add one-click unsubscribe functionality to email newletters?

前端 未结 7 1747
长发绾君心
长发绾君心 2020-12-13 05:24

I\'d like to customize the \"unsubscribe\" links in our email newsletters so that they remove the recipient with a single click. Right now they just point to a generic page

7条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-13 05:50

    You can encode a URL like so:

    http://yourserver.com/unsubscribe///
    

    Where is something like HMAC(secretkey, "/"). Encoded-email can just be a URL-encoding of the email, or it can be an actually encrypted (AES+CBC+Base64 or similar) version of the email. Using full encryption would seem to be of little use though - since the person receiving this has their own email address anyway.

    This signature scheme has the advantage of not needing any database storage, while remaining secure against malicious attempts to unsubscribe someone.

    Alternately (or in addition to the above), you can send a confirmation mail out to confirm the user's intent. This avoids problems if the user forwards the email.

提交回复
热议问题