<?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-06" 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="September" 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"/>
                email header field can contain <xref target="RFC7230">HTTPS</xref> URIs. In a
                List-Unsubscribe header field the HTTPS URI is intended to unsubscribe the
                recipient of the email 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 a
		request made automatically by
		anti-spam software from one manually requested by a user.
                To prevent accidental unsubscriptions, senders return
                landing pages with a confirmation step to finish the unsubscribe
		request that a live user would recognize and act on,
		but an automated system would not.
		This 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 from senders with a lot of junk reports often has poor deliverability.
	      Hence the mailers
	      want to make it as easy as possible for recipients to unsubscribe, since
	      the recipient's alternative to a difficult unsubscription process is to report mail
	      from the sender as junk until it goes away.
	   </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 give
	      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>
                    An mail sender that wishes to enable one-click unsubscribes 
		    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 contains key/value pairs needed
                    by the mail sender, separated by ampersands.
		    The list of key/value pairs MUST contain the pair
                    "List-Unsubscribe=One-Click".
		    There is no provision for continuing a List-Unsubscribe-Post header field, so the
		    size of the of key/value pairs is limited by the maximum length of a line.
                </t>
                <t>
                    The combination of the URI in the List-Unsubscribe header and the POST
                    arguments in the List-Unsubscribe-Post 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.
		    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 URI and POST arguments 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
		   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 a victim list as a side effect of users reporting the spam.		   
		</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 One-Click action triggered by this URI SHOULD complete promptly
                    and not burden the requester in an inappropriate way. The mail sender
		    MUST NOT return an HTTPS redirect, since
		    redirected POST actions have historically not worked reliably.
                </t>
            </section>
            <section title="Mail receivers">
                <t>
                    A mail receiver that wants do a one-click unsubscription
		    performs an
                    HTTPS POST to the HTTPS URI in the
                    List-Unsubscribe header and sends the content of 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>
                    and 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 or similar to
                    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 email 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>
        </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
    0*( "&" postarg) CRLF

postarg = ALPHA 0*ldh "=" freetext

freetext = 1*(%x20-%xfe)
   ; space, ampersand, percent, equal sign, and non-ASCII characters
   ; are percent encoded]]></artwork>
        </figure>

	<t>The percent encoding for freetext is as described in section 2 of <xref target="RFC7578"/>.
	</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&recip=user@example.com
]]></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: 49

List-Unsubscribe=One-Click&recip=user@example.com
]]></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&recip=user@example.com
]]></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: 49

List-Unsubscribe=One-Click&recip=user@example.com
]]></artwork>
                </figure>
            </section>
        </section>
        <section title="Security Considerations">
            <t>
                The List-Unsubscribe-Post and/or 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 creative mailer could send spam with content intended to provoke large numbers
                of unsubscriptions, with suitably crafted headers to send POST
                requests with arbitrary contents 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.
            </t>
            <t>
	       Since the mailer's server that receives the POST request cannot in general tell where
	       the request
	       coming from, the URI or POST arguments 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.
	    </t>

        </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 -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>
