<?xml version="1.0"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
  <!ENTITY rfc2119 PUBLIC '' 'https://bib.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml'>
  <!ENTITY rfc2045 PUBLIC '' 'https://bib.ietf.org/public/rfc/bibxml/reference.RFC.2045.xml'>
  <!ENTITY rfc2046 PUBLIC '' 'https://bib.ietf.org/public/rfc/bibxml/reference.RFC.2046.xml'>
  <!ENTITY rfc2231 PUBLIC '' 'https://bib.ietf.org/public/rfc/bibxml/reference.RFC.2231.xml'>
  <!ENTITY rfc3864 PUBLIC '' 'https://bib.ietf.org/public/rfc/bibxml/reference.RFC.3864.xml'>
  <!ENTITY rfc3986 PUBLIC '' 'https://bib.ietf.org/public/rfc/bibxml/reference.RFC.3986.xml'>
  <!ENTITY rfc5322 PUBLIC '' 'https://bib.ietf.org/public/rfc/bibxml/reference.RFC.5322.xml'>
  <!ENTITY rfc6838 PUBLIC '' 'https://bib.ietf.org/public/rfc/bibxml/reference.RFC.6838.xml'>
  <!ENTITY rfc8174 PUBLIC '' 'https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml'>
    
]>
<?xml-stylesheet type="text/xsl" href="rfc2629.xslt"?>
<rfc category="exp" ipr="pre5378Trust200902" docName="draft-melnikov-email-big-files-00">
	<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
	<?rfc toc="yes" ?>
	<?rfc symrefs="yes" ?>
	<?rfc sortrefs="yes"?>
	<?rfc iprnotified="no" ?>
	<?rfc strict="yes" ?>
	<?rfc comments="yes" ?>
	<?rfc inline="yes" ?>
	<?rfc compact="yes"?>
	<?rfc subcompact="no"?>
	<front>
		<title abbrev="Big Files in Email">
      Referencing big external files in email messages
    </title>
        <author initials="B." surname="Gondwana" fullname="Bron Gondwana">
            <organization abbrev="FastMail">
                FastMail
            </organization>
            <address>
                <email>brong@fastmailteam.com</email>
            </address>
        </author>

		<author initials="A." surname="Melnikov" fullname="Alexey Melnikov">
			<organization abbrev="Isode">
				Isode Limited
			</organization>
			<address>
				<email>alexey.melnikov@isode.com</email>
				<uri>https://www.isode.com</uri>
			</address>
		</author>

    <date year="2023"/>
		<abstract>

            <t>This document specifies a way to reference big attachments
            in email messages without including them inline.
            </t>

    </abstract>
	</front>
	<middle>
    
    <section title="Introduction and Overview">

      <t>
      Most SMTP systems limit the size of messages that can be sent,
      which can be as low as 10 Megabytes. Moreover, limits vary
      depending on recipient's system. 
      End-users want to send files to each other and the file sizes that end-users create keep getting bigger.
      This document specifies a way to reference big attachments
      in email messages <xref target="RFC5322"/> without including them inline.
      
      In order to achieve this the document defines a new email header field "Content-External" as specified in <xref target="content-external"/>.
      </t>

    </section>

    <section title="Document Conventions">
      
        <t>
        The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
        "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
        "OPTIONAL" in this document are to be interpreted as described in BCP
        14 <xref target="RFC2119"/> <xref target="RFC8174"/>
        when, and only when, they appear in all capitals, as shown here.
        </t>
      
    </section>

    <section title="Content-External header field" anchor="content-external">

        <t>
        The Content-External header field can appear multiple times. Each instance describes an externally referenced attachment.
        </t>

        <t>
        The generic syntax of Content-External header field is the same
        syntax as used by the Content-Type header field
        <xref target="RFC2045"/>, so the same generic parser can be used.
        The media-type value is the media type of the external attachment
        being referenced. (Note that if a different media type is returned
        when the external attachment is retrieved, the value in the header field overwrites the value returned by the retrieval protocol).
        </t>

        <t>
        The list of currently defined attributes of Content-External is included below. See <xref target="syntax"/> for details of the syntax.

        <list>
          <t>
          URL -- URI <xref target="RFC3986"/> (typically an HTTPS URL) used to access the external attachment. This parameter is required
          and it can only appear once.
          </t>

          <t>
          NAME -- The recommended name of the external attachment. This parameter is optional, but can't appear more than once.
          </t>

          <t>
          DIGEST-&lt;digest-name&gt; -- Value of the specified digest <!--///Need more details of the syntax. Hex? Or Use Content-Digest format?-->of the external attachment in its canonical form, that is,
          before any Content-Transfer-Encoding has been applied
          or after the data have been decoded. This parameter
          is optional, but can't appear more than once.
          </t>

          <t>
          EXPIRATION -- The date (in the <xref target="RFC5322"/> "date-time"
          syntax) after which the existence of the external data is not guaranteed.  This parameter is optional, but can't appear more than once.
          </t>

          <t>
          SIZE -- The size (in octets) of the data.  The intent
          of this parameter is to help the recipient decide
          whether or not to expend the necessary resources to
          retrieve the external data.  Note that this describes
          the size of the data in its canonical form, that is,
          before any Content-Transfer-Encoding has been applied
          or after the data have been decoded.  This parameter
          is optional, but can't appear more than once.
          </t>

          <t>
          <!--///Do we really care about this one?-->
          PERMISSION -- A case-insensitive field that indicates
          whether or not it is expected that clients might also
          attempt to overwrite the data.  By default, or if
          permission is "read", the assumption is that they are
          not, and that if the data is retrieved once, it is
          never needed again.  If PERMISSION is "read-write",
          this assumption is invalid, and any local copy must be
          considered no more than a cache.  "Read" and "Read-write"
          are the only defined values of permission.  This parameter
          is optional, but can't appear more than once.
          </t>

        </list>

        </t>

        <t>
        <!--///Is this really a good idea? Or should we just limit ourselves to the quoted string syntax-->
        In order to allow for long parameters, <xref target="RFC2231"/> encoding can be used in Content-External parameter values.
        </t>

<!--
     Content-Type: message/external-body; name="BodyFormats.ps";
                   url="https://www.example.com/storage/123"
                   access-type=URL;
                   expiration="Fri, 14 Jun 1991 19:13:14 -0400 (EDT)";
                   size=1234567

     Content-type: application/postscript
     Content-ID: <id42@guppylake.bellcore.com>

     Fake body, which is usually ignored
-->
<figure><artwork><![CDATA[
Simple example 1:

    Content-External: application/postscript; name="BodyFormats.ps";
                   url="https://www.example.com/storage/123";
                   expiration="Thu, 30 Nov 2023 19:13:14 -0400 (EDT)";
                   size=1234567

Example 2:
     Content-type: text/html;
                   URL="https://www.example.org/1/2/3/4/5/6/7/
                        8/9/10/11/12/13/14/15/16/17/18/20/21/
                          file.html"; SIZE=100000000;
                    digest-SHA-256="..."
]]></artwork></figure>

<!--///Add an example with RFC 2231 encoding!-->

        <t>
        [[Open Issue: ]] The ability to include Content-ID header field is lost, when compared to message/external-body, so external attachments can't be referenced inside multipart/related? Should we define "id" as a new parameter of Content-External to address this issue?
        </t>

        <t>
        The Content-External header field appears in the header section of the body part that is used to display a message to a user of a MUA
        that doesn't support this extension. Such body parts MUST have
        either "text/plain" or "text/html" media types. (Future revisions of or extensions to this document can allow use of Content-External with
        other media types).
        If a Content-External header field appears in the header section of a body part which is not listed above, it MUST be ignored.

        [[Also allow it at the top level message level?]]
        </t>

        <t>
        MUAs compliant with this specification SHOULD hide body parts
        with one of the media types listed above that also contain a Content-External header field. They MAY present a UI allowing the user to download such external attachments or they MAY do this automatically.
        [[See Security Considerations. Should we always require user confirmation?]] 
        </t>
      
    </section>

    <section title="Formal syntax" anchor="syntax">

		<t>The following syntax specification uses the Augmented Backus-Naur Form (ABNF) notation as specified in <xref target="ABNF"/>.</t>
		<t>Non-terminals referenced but not defined below are as defined by <xref target="RFC2045">MIME, part 1</xref>.</t>
		<t>Except as noted otherwise, all alphabetic characters are case-insensitive.
        The use of upper or lower case characters to define token strings is for editorial clarity only.
        Implementations MUST accept these strings in a case-insensitive fashion.</t>

<!--///Add ABNF for digest-<digest-name>-->

<figure><artwork><![CDATA[
type-name = <Defined in RFC 6838>
subtype-name = <Defined in RFC 6838>

content-external = "Content-External" ":"
           [FWS] media-type [CFWS]
           *([FWS] ";" [FWS] parameter) [FWS]

media-type = type-name "/" subtype-name
           ; Matching of media type and subtype
           ; is ALWAYS case-insensitive.

parameter = attribute [FWS] "=" [FWS] value

attribute = token
             ; Matching of attributes
             ; is ALWAYS case-insensitive.

value = token / quoted-string

token = 1*<any (US-ASCII) CHAR except SPACE, CTLs,
            or tspecials>

tspecials =  "(" / ")" / "<" / ">" / "@" /
              "," / ";" / ":" / "\" / <">
              "/" / "[" / "]" / "?" / "="
              ; Must be in quoted-string,
              ; to use within parameter values

allowed-display-media-parts = "text/plain" / "text/html"
              ; Allowed media types for display body parts
              ; where Content-External is allowed.


registered-content-external-params = url-param / name-param /
    expiration-param / size-param / permission-param /
    digest-params


url-param = "URL" [FWS] "=" [FWS] url

url = value
      ; Syntax as described by absolute-URI in RFC 3986
      ; When represented as a quoted-string, internal
      ; SP/TAB are stripped from the value before full
      ; URL is reconstructed.

name-param = "NAME" [FWS] "=" [FWS] value
      ; Recommended file name

expiration-param = "EXPIRATION" [FWS] "=" [FWS] expiration-value

expiration-value = quoted-string
                   ; the quote string value is [ day-name "," ] date-strict
                   ; time-strict

day-name = <Defined in RFC 5322>

date-strict = day SP month SP year
       ; day month year

day =   1*2DIGIT

year =  4*DIGIT

month = <Defined in RFC 5322>

time-strict  =   time-of-day zone

time-of-day     =   hour ":" minute [ ":" second ]

hour            =   2DIGIT

minute          =   2DIGIT

second          =   2DIGIT

zone            =   SP ( "+" / "-" ) 4DIGIT

size-param = "SIZE" [FWS] "=" [FWS] number64

number64 = 1*DIGIT
           ; Unsigned 63-bit integer
           ; (0 <= n <= 9,223,372,036,854,775,807)

permission-param = "PERMISSION" [FWS] "=" [FWS] permission-value

permission-value = "read" / "read-write"
          ; The values are case-insensitive

digest-params = 1*digest-param
          ; Multiple attributes of this form are allowed,
          ; as long as they all use different hashes

digest-param = "DIGEST-" digest-name [FWS] "=" [FWS] digest-value

digest-name = atom
          ; IANA registered. E.g. SHA-1, SHA-256
          
digest-value = value
          ; Define exact syntax...

FWS = <Defined in RFC 5322>

CWFS = <Defined in RFC 5322>
]]></artwork></figure>
      
		</section>


		<section title="Security Considerations">

            <t>
            TBD: tracking access to the remote file on the web server
            to determine that the message was read by the recipient.
            (Countermeasure: automatic download by the recipient's mailstore
            or MUA, using private browsing relay.)
            </t>

            <t>
            TBD: Content possibly changing after the email message was sent and mitigations (include the hash).
            </t>

            <t>
            TBD: dealing with encrypted files. Also how can antivirus solutions check content automatically.
            </t>

		</section>

		<section title="IANA Considerations">
        
			<t>
            This document requests IANA to add the following registration to the Permanent Message Header Field Registry, in accordance with the procedures set out in <xref target="RFC3864"/>.
			</t>

<figure><artwork><![CDATA[
   Header field name:  Content-External
   Applicable protocol:  Mail
   Status:  standard
   Author/Change controller:  IETF
   Specification document(s):  [RFCXXXX]
]]></artwork></figure>

        <!--///Create or reuse a new registry for hash names?-->

        </section>

    <section title="Requirements on the solution and alternative solution not taken">

      <t>
      The proposed solution is motivated by the following requirements:

        <list>
          <t>
          Clients that don't support the email extension proposed in this document should be able to show links to external attachments.
          </t>

          <t>
          Multiple external attachments can be specified.
          </t>

          <t>
          External attachments can be referenced in draft messages.
          </t>

        </list>

      </t>

      <t>
      <xref target="RFC2046"/> specifies the message/external-body media type
      that otherwise would be a good fit, but many widely deployed email
      clients display it as an attachment with no link to the external attachment visible.
      </t>

    </section>
    
    <section title="Acknowledgments">

      <t>
      Editors of this document would like to thank the following people
      who provided useful comments and/or participated in discussions that
      lead to this document, in particular: .
      </t>

      <t>
      This document copies some text from RFC 2046, thus the efforts
      of the authors of RFC 2046 are appreciated.
      </t>

		</section>
		
	</middle>
	<back>
		<references title="Normative References">
            &rfc2119;
            &rfc8174;
            &rfc2045;
            &rfc2231;
            &rfc3864; <!--Header Field registration procedure-->
            &rfc3986; <!--URI Syntax-->
            &rfc5322;
            &rfc6838;
            <reference anchor="ABNF">
				<front>
					<title>Augmented BNF for Syntax Specifications: ABNF</title>
					<author initials="D" surname="Crocker" fullname="Dave Crocker" role="editor">
						<organization />
					</author>
					<author initials="P" surname="Overell" fullname="Paul Overell" role="editor">
						<organization />
					</author>
					<date year="2008" month="January"/>
				</front>
				<seriesInfo name="RFC" value="5234" />
				<format type="TXT" target="https://www.rfc-editor.org/info/rfc5234" />
			</reference>

    </references>

    <references title="Informative References">
            &rfc2046;
    </references>

	</back>
</rfc>
