<?xml version="1.0" encoding="US-ASCII"?>
<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
        <!ENTITY RFC2119 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml">
        <!ENTITY RFC2369 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2369.xml">
	<!ENTITY RFC5234 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5234.xml">
        <!ENTITY RFC5322 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5322.xml">
        <!ENTITY RFC6376 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.6376.xml">
        <!ENTITY RFC7230 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.7230.xml">
        <!ENTITY RFC7578 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.7578.xml">
        ]>
<?rfc compact="yes" ?>
<?rfc subcompact="no" ?>
<?rfc toc="yes" ?>
<?rfc tocindent="yes" ?>
<?rfc tocdepth="2" ?>
<?rfc symrefs="yes" ?>
<?rfc sortrefs="yes"?>
<?rfc iprnotified="no" ?>
<rfc category="std" docName="draft-levine-herkula-oneclick-09" ipr="trust200902">
    <front>
        <title abbrev="One click unsubscribe">Signalling one-click functionality for list email headers</title>
        <author fullname="John Levine" initials="J." surname="Levine">
            <organization>Taughannock Networks</organization>
            <address>
                <postal>
                    <street>PO Box 727</street>
                    <city>Trumansburg</city>
                    <code>14886</code>
                    <region>NY</region>
                </postal>
                <phone>+1 831 480 2300</phone>
                <email>standards@taugh.com</email>
                <uri>http://jl.ly</uri>
            </address>
        </author>
        <author fullname="Tobias Herkula" initials="T." surname="Herkula">
            <organization>optivo GmbH</organization>
            <address>
                <postal>
                    <street>Wallstrasse 16</street>
                    <city>Berlin</city>
                    <code>10179</code>
                    <country>DE</country>
                </postal>
                <phone>+49 30 768078 129</phone>
                <email>t.herkula@optivo.com</email>
                <uri>https://www.optivo.com</uri>
            </address>
        </author>
        <date month="November" year="2016"/>
        <area>Operations and Management</area>
        <keyword>email</keyword>
        <keyword>mailing list</keyword>
        <abstract>
            <t>
                This document describes a method for signaling a one-click function for
                the List-Unsubscribe email header field. The need for this arises out of the
                actuality that mail software sometimes fetches URLs in mail header fields, and
                thereby accidentally triggers unsubscriptions in the case of the
                List-Unsubscribe header field.
            </t>
        </abstract>
    </front>
    <middle>
        <section title="Introduction and Motivation">
            <t>
                An <xref target="RFC2369"/> List-Unsubscribe
		email header field can contain <xref target="RFC7230">HTTPS</xref> URIs. In that
		header field the HTTPS URI is intended to unsubscribe the
                recipient of the message from the list. But anti-spam software often
                fetches all resources in mail header fields automatically, without any action
                by the user, and there is no mechanical way for a sender to tell whether a
		request was made automatically by
		anti-spam software or manually requested by a user.
                To prevent accidental unsubscriptions, senders return
                landing pages with a confirmation step to finish the unsubscribe
		request.  A live user would recognize and act on the confirmation step,
		but an automated system would not.
		That makes the unsubscription process more complex than a single click.
            </t>
	    <t>
	      Operators of broadcast marketing lists tend to be primarily concerned about deliverability
	      of their mail:
	      whether the mail is delivered to the recipients and how the messages are
	      presented, e.g., whether in the primary inbox or in a junk folder.
	      Many mail systems allow recipients to report mail as spam or junk,
	      and mail streams from senders whose mail is often reported as junk tend to have poor deliverability.
	      Hence the mailers
	      want to make it as easy as possible for recipients to unsubscribe;
	      if an unsubscription process is too difficult, the recipient's alternative is to report mail
	      from the sender as junk until the mail no longer appears in the recipient's inbox.
	   </t>
	   <t>
	      Operators of recipient mail systems are aware that their users do not make a clear
	      distinction between unsubscription and junk. In some cases they allow
	      trustworthy mailers to request notification when their mail is reported as
	      junk, so they can unsubscribe the recipient, but
	      the process of identifying trustworthy mailers and notifying them
	      does not scale well to large numbers of small mailers.
	      This specification
	      provides a way for recipient systems to notify the mailer automatically,
	      using only information within the mail message, and without prearrangement.
	      Some recipient systems might wish to send an unsubscription notice to
	      mailers whenever a user reports a message as junk, or they might offer
	      the user the option to report and unsubscribe.
	   </t>
            <t>
                If a mail recipient is unsubscribing manually and the unsubscription
		process requires confirmation, the resulting web
                page is presented to the recipient who can then click the appropriate
                button.
                But when the unusubscribe action is combined with a MUA junk report,
		there is no direct user interaction with the
                mailer's web site.
		Similarly, if a mail system automatically unsubscribes recipient mailboxes
		that have been closed or abandoned,
		there can be no interaction with a user who is not present.
                In those cases, the unsubscription process has to work without
		manual intervention, and in particular without requiring that
		software attempt to interpret the contents of a confirmation page.
            </t>
            <t>
                This document addresses this part of the problem, with an HTTPS POST
                action for mail receivers.
		Mail senders can distinguish this action from other
                unsubscribe requests and handle it as a one-click unsubscription without
                manual intervention by the mail recipient.
            </t>
<!-- take out unless people want the explanation back
	    <t>
	       A List-Unsubscribe header field can also contain a mailto: URI with an
	       address to which an unsubscription request is sent.
	       While these URIs can be used for a one-click unsubscribe, experience
	       has shown that they do not work well in high volume environments,
	       because the mail systems (typically e-mail service providers
	       that are configured to send large volumes of mail) cannot keep up with the
	       required number of mailed removal requests.
	       Hence this document considers only HTTPS URIs.
            </t>
	    -->
            <t>This document has several goals.
                <list style="symbols">
                    <t>
		       Allow email senders to signal that
			a  <xref target="RFC2369"/> List-Unsubscribe header field has
			One-Click functionality.
		    </t>
                    <t>
                        Allow MUA users to unsubscribe from mailing lists in a familiar environment
                        and without leaving the MUA context.
			A receiving system can process an unsubscription request in the background
			without further interaction,
			and know that it can be fully processed by the mail sender's system.
		    </t>
                </list>
            </t>
        </section>
        <section title="Definitions">
            <t>
                The key words "MUST", "MUST NOT", "REQUIRED", "SHALL",
                "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and
                "OPTIONAL" in this document are to be interpreted as described in
                <xref target="RFC2119"/> when written in all capital letters.
            </t>
        </section>
        <section title="Implementation">
            <section title="Mail senders">
                <t>
                    A mail sender that wishes to enable one-click unsubscriptions
		    places one
                    List-Unsubscribe header field and one List-Unsubscribe-Post header field in the message.
		    The List-Unsubscribe header field MUST contain one HTTPS URI.
		    It MAY contain other non-HTTP/S URIs such as MAILTO:.
		    The List-Unsubscribe-Post header MUST contain the single key/value pair
                    "List-Unsubscribe=One-Click".
		    As described below, the message MUST have a valid DKIM signature that covers
		    at least the List-Unsubscribe and List-Unsubscribe-Post headers.
                </t>
                <t>
                    The URI in the List-Unsubscribe header
		    MUST contain enough information
		    to identify the mail recipient and the list from which the recipient is to be removed,
		    so that the unsubscription process can complete automatically.
		    Since there is no provision for extra POST arguments, any information about
		    the message or recipient is encoded in the URI.
		    In particular, One-click has no way to ask the user
                    what address or from what list the user wishes to unsubscribe.
                </t>
		<t>
		   The POST request SHOULD NOT include cookies, http authorization, or any other
		   context information.
		   The unsubscribe operation is logically unrelated to any previous Web activity
		   and context information could inappropriately link the unsubscribe to previous
		   activity.
		</t>
		<t>
		   The URI SHOULD include an opaque identifier
		   or other hard to forge component
		   in addition to or instead of the plain-text names of the list and
		   the subscriber.
		   The server handling the unsubscription SHOULD verify that the
		   opaque or hard to forge component is valid.
		   This will deter attacks in which a malicious party sends spam
		   with List-Unsubscribe links for a victim list, with the intention of causing list
		   unsubscriptions from the victim list as a side effect of users reporting the spam,
		   or where the attacker does POSTs directly to the mail sender's unsubscription server.
		</t>
                <t>
                    The mail sender needs to provide the infrastructure to handle POST
                    requests to the specified URI in the List-Unsubscribe header, and to
		    handle the unsubscribe requests that its mail will provoke.
                </t>
                <t>
		   The mail sender
		    MUST NOT return an HTTPS redirect, since
		    redirected POST actions have historically not worked reliably,
		    and many browsers have turned redirected http POSTs into GETs.
                </t>
		<t>
		   This document does not update <xref target="RFC2369" /> so the usage of
		   List-Unsubscribe URIs other than for one-click remains unchanged.
		</t>
            </section>
            <section title="Mail receivers">
                <t>
                    A mail receiver can do a one-click unsubscription
		    by performing an
                    HTTPS POST to the HTTPS URI in the
                    List-Unsubscribe header. It sends the key/value pair in the
                    List-Unsubscribe-Post header as the request body.
                </t>
                <t>
                    The POST content SHOULD be sent as
                    <xref target="RFC7578">"multipart/form-data"</xref>
		    or MAY be sent as "application/x-www-form-urlencoded".
                    These encodings are the ones used by web browsers when sending forms.
                    The target of the POST action is the same as
                    the one in the GET action for a manual unsubscription,
		    so this is intended to allow the same server code to handle both.
                </t>
                <t>
                    The mail receiver MUST NOT perform a POST on the the HTTPS
                    URI without user consent. When and how the user consent is obtained is
                    not part of this specification.
                </t>
            </section>
        </section>
        <section title="Additional Requirements">
            <t>
                The message needs at least one valid authentication identifier. In this
                version of the specification the only supported identifier type is DKIM
                <xref target="RFC6376"/>.
		Hence senders MUST apply at least one valid DKIM signature to the message.
	    </t><t>
	       The List-Unsubscribe and List-Unsubscribe-Post headers MUST
               be covered by the signature and included in the "h=" tag of a valid DKIM-Signature header field.
            </t>
            <t>
	       If the message does not have the required DKIM signature, the mail receiver SHOULD NOT
	       offer a one-click unsubscribe for that message.
            </t>
        </section>
        <section title="Header Syntax">
        <t>The following ABNF imports fields, WSP, and CRLF from <xref target="RFC5322"/>.
	   It imports ALPHA and DIGIT from <xref target="RFC5234"/>.
	</t>

        <figure>
          <artwork><![CDATA[
fields /= list-unsubscribe-post

ldh = ALPHA 0*(ALPHA | DIGIT | "-")

list-unsubscribe-post = "List-Unsubscribe-Post:" 0*1WSP postarg CRLF

postarg = "List-Unsubscribe=One-Click"]]></artwork>
        </figure>

	</section>
	<section title="Security Considerations">
            <t>
                The List-Unsubscribe header can contain a
		plaintext or encoded version of the recipient
                address, but that address is usually also in the To: header.
                This specification allows anyone with access to a message to unsubscribe
                the recipient of the message, but that's typically the case with
                existing List-Unsubscribe, just with more steps.
            </t>
            <t>
                A malicious mailer could send spam with content intended to provoke large numbers
                of unsubscriptions, with suitably crafted headers to send POST
                requests to servers that perhaps don't want them.
                But it's been possible to provoke GET requests in a similar way for a long
                time (and much easier, due to spam filter auto-fetches) so the chances of
                significantly increased annoyance seem low.
		The contents of the List-Unsubscribe-Post header is limited to a single
		known key/value pair to prevent an attacker from creating malicious messages
		where the POST operation could simulate a user filling in an arbitrary form
		on a victim web site.
            </t>
            <t>
	       The unsubscribe operation provides a strong hint to the mailer that the address to
	       which the message was sent was valid, and could in principle be used as a way to
	       test whether an email address is valid.
	       In practice, though, there are simpler ways such as embedding image links into
	       the HTML of a message and seeing whether the recipient fetches the images.
            </t>
            <t>
	       Since the mailer's server that receives the POST request cannot in general tell where
	       the request is
	       coming from, the URI SHOULD contain an opaque identifier
	       or other hard to forge component
	       to identify the list and recipient address.
	       That can ensure that the request originated from List-Unsubscribe and
	       List-Unsubscribe-Post headers in a message the mailer sent.
	       Also, the request SHOULD NOT include cookies or other context information to prevent
	       the server from associating the request with previous web requests.
	    </t>
        </section>
        <section title="IANA Considerations">
            <t>
                IANA is requested to add a new entry to the Permanent Message Header
                Field Names registry.
            </t>
            <t>
                Header field name: List-Unsubscribe-Post
            </t>
            <t>
                Applicable protocol: mail
            </t>
            <t>
                Status: standard
            </t>
            <t>
                Author/Change controller: IETF
            </t>
            <t>
                Specification document: this document
            </t>
        </section>
        <section title="Examples">
            <section title="Simple">
                <figure>
                    <preamble>Header in Email</preamble>
                    <artwork><![CDATA[
List-Unsubscribe: <https://example.com/unsubscribe/opaquepart>
List-Unsubscribe-Post: List-Unsubscribe=One-Click
]]></artwork>
                </figure>
                <figure>
                    <preamble>Resulting POST request</preamble>
                    <artwork><![CDATA[
POST /unsubscribe/opaquepart HTTP/1.1
Host: example.com
Content-Type: application/x-www-form-urlencoded
Content-Length: 26

List-Unsubscribe=One-Click
]]></artwork>
                </figure>
            </section>
            <section title="Complex">
                <figure>
                    <preamble>Header in Email</preamble>
                    <artwork><![CDATA[
List-Unsubscribe: <mailto:listrequest@example.com?subject=unsubscribe>,
    <https://example.com/unsubscribe.html?opaque=123456789>
List-Unsubscribe-Post: List-Unsubscribe=One-Click
]]></artwork>
                </figure>
                <figure>
                    <preamble>Resulting POST request</preamble>
                    <artwork><![CDATA[
POST /unsubscribe.html?opaque=123456789 HTTP/1.1
Host: example.com
Content-Type: application/x-www-form-urlencoded
Content-Length: 26

List-Unsubscribe=One-Click
]]></artwork>
                </figure>
            </section>
            <section title="Complex with multipart/form-data">
                <figure>
                    <preamble>Header in Email</preamble>
                    <artwork><![CDATA[
List-Unsubscribe: <mailto:listrequest@example.com?subject=unsubscribe>,
    <https://example.com/unsubscribe.html/opaque123456789>
List-Unsubscribe-Post: List-Unsubscribe=One-Click
]]></artwork>
                </figure>
                <figure>
                    <preamble>Resulting POST request</preamble>
                    <artwork><![CDATA[
POST /unsubscribe.html/opaque123456789 HTTP/1.1
Host: example.com
Content-Type: multipart/form-data; boundary=------FormBoundaryjWmhtjORrn
Content-Length: 218

------FormBoundaryjWmhtjORrn
Content-Disposition: form-data; name="List-Unsubscribe"

One-Click
------FormBoundaryjWmhtjORrn--
]]></artwork>
                </figure>
            </section>
        </section>
    </middle>
    <back>
        <references title="Normative References">
            &RFC2119;
            &RFC2369;
            &RFC5234;
            &RFC5322;
            &RFC6376;
            &RFC7230;
            &RFC7578;
        </references>
        <section title="Change Log">
            <t>
                Remove this section before publication, please.
	    </t>
	    <section title="Changes from -08 to -09">
	       <t>
		  Editorial clarifications, strip out obsolete mentions of
		  variable POST arguments.
	       </t>
	    </section>
	    <section title="Changes from -07 to -08">
	       <t>
		  Editorial changes per Ops directorate and security review.
	       </t><t>
		  Simplify POST argument to one field.
	       </t><t>
		  Send no context info.
	       </t>
	    </section>
	    <section title="Changes from -06 to -07">
	       <t>
		  Added example with multipart/form-data encoding
	       </t>
	    </section>
            <section title="Changes from -05 to -06">
                <t>
		   Add opaque parts to the security discussion.
		   Editing changes, entities are now senders and receivers,
		   MUSTage clarified.
		</t>
	    </section>
            <section title="Changes from -04 to -05">
                <t>
		   Reorganize first sections and add more background.  Add ABNF.  Add more security advice.
		</t>
	    </section>
	    <section title="Changes from -03 to -04">
                <t>
		   Require HTTPS. More motivation.
		</t>
	    </section>
            <section title="Changes from -02 to -03">
                <t>
                    Describe motivation in intro.
                    Clarify required DKIM.
                    More paranoid scenarios.
                </t>
            </section>
        </section>
    </back>
</rfc>
