List-Unsubscribe

57 views
Skip to first unread message

David Manns

unread,
Jan 13, 2024, 3:16:47 PM1/13/24
to py4web
In an effort to keep up with Gmail/Yahoo tightening up on email security I was trying to get my bulk emails to display gmail's Unsubscribe button.

This involves setting the List-Unsubscribe header in the email.

py4web/utils/mailer.py (line 745) assumes that the supplied named argument list_unsubscribe is an email address which it converts into a mailto:

However, the standard rfc2369 allows for either mailto: or http..., see https://www.rfc-editor.org/pdfrfc/rfc2369.txt.pdf

My unsubscribe link, which is included at the end of the email is a link to the py4web app.

I tried modifying mailer.py to not add the 'mailto' but this did not generate the gmail unsubscribe button. I also tried supplying an email address to an unmodified mailer.py in list_unsubscribe and this was not recognized by gmail either.

Now at a loss!

David

David Manns

unread,
Jan 31, 2024, 4:26:10 PM1/31/24
to py4web
This issue may be important as Google and Yahoo are both supposedly tightening up requirements on bulk email senders. Implementing the google 'unsubscribe' button may be a requirement soon.

As far as I can tell, adding a List-Unsubscribe header containing a mailto link like "<mailto:_some_email_address?subject=unsubscribe>" should work. As noted above, the py4web mailer assumes it is given an email string and embeds it thus:
payload["List-Unsubscribe"] = "<mailto:%s>" % list_unsubscribe

Adding list_unsubscribe does not cause the unsubscribe button to appear at the (gmail) receiving end.

In addition, a true implementation would use an http link to avoid any manual step, but to avoid unwanted unsubscriptions caused by mechanisms like chrome's 'enhanced safe browsing' List-Unsubscribe-Post headers would also be required as described in https://www.rfc-editor.org/rfc/pdfrfc/rfc8058.txt.pdf - py4web doesn't appear to support this header.

Furthermore the RFC8058 spec also implies that there needs to be a DKIM signature in the message but I have no idea how to implement this, it appears to be supported by py4web but is not documented. This may be why my List-Unsubscribe is being ignored?

David

David Manns

unread,
Feb 14, 2024, 1:00:21 PM2/14/24
to py4web
Reply all
Reply to author
Forward
0 new messages