alphagov / notifications-php-client

PHP client for the GOV.UK Notify API
https://docs.notifications.service.gov.uk/php.html
MIT License
11 stars 13 forks source link

Feature request: option to set email headers #55

Closed RobjS closed 5 months ago

RobjS commented 5 years ago

We have seen reports of mail sent via GOV.UK Notify being delivered into spam mailboxes. We can't know exactly what is causing this, but we have identified that the headers of the mail do not identify the mail as having an automated source.

(Some classification systems may treat automated mails, that do not declare themselves, as suspicious.)

It would help to address this if the email facility for GOV.UK Notify was extended to support two additional sender-specified headers.

  1. List-Unsubscribe:

Senders should have the ability to specify a List-Unsubscribe header consisting of one or more comma-sepatated angle-bracket enclosed URLs.

For our purpose we would only need to specify one.

List-Unsubscribe: <https://example.blog.gov.uk/subscribe/?subscriber=example@example.com>

This URL would provide a mechanism for unsubscribe (but would be in addition to unsubscribe links in the body text).

This header would be used both by some email clients to provide easy subscription management, and by email filtering and classification systems.

Technical reference is: https://tools.ietf.org/html/rfc2369

  1. Auto-Submitted:

Senders should have the ability to specify an Auto-Submitted header with a valid value.

For our purposes "auto-generated".

Auto-Submitted: auto-generated

This header is used by mail processing systems, primarily as a means of avoiding mail-loops caused by auto responders.

Technical reference is: https://www.iana.org/assignments/auto-submitted-keywords/auto-submitted-keywords.xhtml https://tools.ietf.org/html/rfc3834#section-5 https://tools.ietf.org/html/rfc5230#page-8

idavidmcdonald commented 4 years ago

Hi, sorry for the extremely late reply to this issue but just doing a bit of housekeeping.

These both seem like reasonable suggestions and the first one we had considered in the past but hadn't yet acted on.

I can't promise we will get to either of these any time soon but they both sound sensibleand will be something we will consider alongside all the other features we would like to roll out.

I'll leave this open for others to see and add any further weight to if they so wish. Thanks for your input and time to create an issue that is very easy to understand!

snim2 commented 6 months ago

Just a note that as of Feb 2024 Google are tightening up their rules on which emails count as SPAM. This is the relevant part of that page:

Important: If you send more than 5,000 message per day, your marketing and subscribed messages must support one-click unsubscribe.

idavidmcdonald commented 6 months ago

FYI, this is something we are going to be looking at over the coming weeks. I'm not sure if it will allow you to pass in any email header you want or maybe just List-Unsubscribe but we are expecting to roll out a change in this area shortly so stay tuned!

In terms of the deadline, I can't find the reference off the top of my head but it is looking likely to be in July that Google start enforcing this so we hope to give the feature to teams before this point (ideally with enough time for you to implement any changes)

leohemsted commented 5 months ago

Hi @RobjS,

Thanks for the feedback, and sorry for delay in getting back to you!

This change has now been made in version 6.1.0! (https://github.com/alphagov/notifications-php-client/pull/134)

You can read the documentation here: https://docs.notifications.service.gov.uk/php.html#one-click-unsubscribe-url-optional

We're hoping to provide additional ways to help our users support unsubscribe journeys within the upcoming weeks and months.

Any questions or comments, just let us know.

Thanks!