<?xml version="1.0" encoding="UTF-8"?><specification xmlns="http://docbook.org/ns/docbook" xmlns:cs="http://www.w3.org/XML/XProc/2006/04/components#" xmlns:e="http://www.w3.org/1999/XSL/Spec/ElementSyntax" xmlns:p="http://www.w3.org/ns/xproc" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="step-mail" class="ed" role="step" version="5.0-extension w3c-xproc">
  <info>
    <title>XProc 3.1: mail steps</title>
    <!-- defaults to date formatted <pubdate>2014-12-18</pubdate> -->
<copyright><year>2018</year><year>2019</year><year>2020</year>
<year>2021</year><year>2022</year><year>2023</year><year>2024</year><year>2025</year>
<holder>the Contributors to the XProc 3.1 Standard Step Library
specifications</holder>
</copyright>

<bibliomisc role="repository">XProc/specification</bibliomisc>
<bibliomisc role="w3c-cg" xlink:href="https://www.w3.org/community/xproc-next/">XProc Next</bibliomisc>

    <bibliorelation type="isformatof" xlink:href="specification.xml">XML</bibliorelation>
    <authorgroup>
      <author>
        <personname>Norman Walsh</personname>
      </author>
      <author>
        <personname>Achim Berndzen</personname>
      </author>
      <author>
        <personname>Gerrit Imsieke</personname>
      </author>
      <author>
        <personname>Erik Siegel</personname>
      </author>
    </authorgroup>

    <abstract>
      <para>This specification describes optional mail related steps for
<citetitle>XProc 3.1: An XML Pipeline Language</citetitle>.</para>
    </abstract>

<legalnotice xml:id="sotd" role="status">
  <para>This specification was published by the
  <link xlink:href="https://www.w3.org/community/xproc-next/">XProc
  Next Community Group</link>. It is not a W3C Standard nor is it on
  the W3C Standards Track. Please note that under the
  <link xlink:href="https://www.w3.org/community/about/agreements/cla/">W3C
  Community Contributor License Agreement (CLA)</link> there is a limited
  opt-out and other conditions apply. Learn more about <link xlink:href="https://www.w3.org/community/">W3C Community and Business
  Groups</link>.
  </para>
  
  <para>If you wish to make comments regarding this document, please
  send them to
  <link xlink:href="mailto:xproc-dev@w3.org">xproc-dev@w3.org</link>.
  (<link xlink:href="mailto:xproc-dev-request@w3.org?subject=subscribe">subscribe</link>,
  <link xlink:href="https://lists.w3.org/Archives/Public/xproc-dev/">archives</link>).
  </para>

<note role="editorial">
<para>This draft is the “editor’s working draft” and may continue to evolve.
</para>
</note>
</legalnotice>
  </info>

  <section xml:id="introduction">
    <title>Introduction</title>

    <para>This specification describes optional mail related XProc steps.
A machine-readable description of these steps may be found in
<link xlink:href="steps.xpl">steps.xpl</link>. </para>

<para>Familarity with the general nature of
<biblioref linkend="xproc31"/> steps is assumed.</para>
</section>

<section xml:id="library">
<title>Step library</title>

<section xml:id="c.send-mail">
<title>p:send-mail</title>

<para>The <code>p:send-mail</code> step sends an email message.</para>

<p:declare-step type="p:send-mail">
  <p:input port="source" sequence="true" content-types="any"/>
  <p:output port="result" content-types="application/xml"/>
  <p:option name="serialization" as="map(xs:QName,item()*)?"/>
  <p:option name="auth" as="map(xs:string, item()+)?"/>
  <p:option name="parameters" as="map(xs:QName, item()*)?"/>
</p:declare-step>

<para>The first document on the <port>source</port> port is expected to conform to
<biblioref linkend="id-draft-klyne"/>. <error code="C0161">It is a <glossterm>dynamic error</glossterm>
  if the first document on the <port>source</port> port does not conform to the required format.</error>
  Any additional documents are treated as attachments.</para>
  <para>If the mail was send successfully a single <tag>c:result</tag> document whose content
    is “<literal>true</literal>” appears
    on the <port>result</port> port. <error code="C0162">It is a
  <glossterm>dynamic error</glossterm> if the email cannot be send.</error></para>

<para>The <tag>em:content</tag> may contain either text or HTML. To send some other type as
the first message body, you must leave the <tag>em:content</tag> element out of the first
document and supply the body as a second document.</para>

<para>The <code>p:send-mail</code> step has the following options:</para>
<variablelist>
  <varlistentry>
    <term><option>serialization</option></term>
    <listitem>
      <para>The <option>serialization</option> option is used to control
        the serialization of documents for constructing the mail. If a document
        has a “<literal>serialization</literal>” document property, the
        effective value of the serialization options is the union of the two
        maps, where the entries in the “<literal>serialization</literal>”
        document property take precedence.</para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>auth</term>
    <listitem>
      <para>If the mail service requires an authentication to send mails, these
      can be supplied using the <option>auth</option> option.</para>
      <para>The following standard keys are defined:</para>
      <variablelist>
        <varlistentry>
          <term>username (xs:string)</term>
          <listitem>
            <para>The username.</para>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>password (xs:string)</term>
          <listitem>
            <para>The password.</para>
          </listitem>
        </varlistentry>
      </variablelist>
      <para><impl>Other key value pairs in “<literal>auth</literal>” are
      <glossterm>implementation-defined</glossterm></impl>.<error code="C0159">It is a <glossterm>dynamic error</glossterm> if any key in
      the “<literal>auth</literal>” map is associated with a value that is not
      an instance of the required type.</error></para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>parameters</term>
    <listitem>
      <para>The <option>parameters</option> option can be used to supply additional information for
        constructing and sending mails. A number of parameters are
        defined in this specification. <impl>It is
          <glossterm>implementation-defined</glossterm> which other
          key/value pairs in the <option>parameters</option> option are
          supported.</impl></para>
      <variablelist>
        <varlistentry>
          <term>send-authorization  (xs:boolean)</term>
          <listitem>
            <para>If the key is associated with <literal>false</literal> no authentication 
              will be used when sending a mail.</para>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>host (xs:string)</term>
          <listitem>
            <para>The SMTP server.</para>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>port (xs:unsignedShort)</term>
          <listitem>
            <para>The port.</para>
          </listitem>
        </varlistentry>
      </variablelist>
        <para><impl>Other key value pairs in “<literal>auth</literal>” are
        <glossterm>implementation-defined</glossterm></impl>.<error code="C0160">It is a <glossterm>dynamic error</glossterm> if any key in
        the “<literal>parameters</literal>” map is associated with a value that
        is not an instance of the required type.</error></para>
        <para><impl>If no values for “<literal>host</literal>” or “<literal>port</literal>” is specified,
        it it <glossterm>implementation-defined</glossterm> which server and port is used.</impl></para>
    </listitem>
  </varlistentry>
</variablelist>
  
<simplesect>
  <title>Document properties</title>
  <para feature="send-mail-preserves-none">No document properties are preserved.</para>
</simplesect>
</section>
</section>

  <section xml:id="errors">
    <title>Step Errors</title>

    <para>These steps can raise <glossterm role="unwrapped" baseform="dynamic error">dynamic errors</glossterm>. </para>

    <para><termdef xml:id="dt-dynamic-error">A <firstterm>dynamic error</firstterm> is one which occurs while a pipeline
        is being evaluated.</termdef> Examples of dynamic errors include references to URIs that cannot be resolved,
      steps which fail, and pipelines that exhaust the capacity of an implementation (such as memory or disk space). For
      a more complete discussion of dynamic errors, see <xspecref spec="xproc" xref="dynamic-errors"/>. </para>

    <para>If a step fails due to a dynamic error, failure propagates upwards until either a <tag>p:try</tag> is
      encountered or the entire pipeline fails. In other words, outside of a <tag>p:try</tag>, step failure causes the
      entire pipeline to fail.</para>

    <para>The following errors can be raised by this step:</para>

    <?step-error-list level="none"?>

  </section>

  <appendix xml:id="conformance">
<title>Conformance</title>

<para>Conformant processors <rfc2119>must</rfc2119> implement all of the features
described in this specification except those that are explicitly identified
as optional.</para>

<para>Some aspects of processor behavior are not completely specified; those
features are either <glossterm role="unwrapped">implementation-dependent</glossterm> or
<glossterm role="unwrapped">implementation-defined</glossterm>.</para>

<para><termdef xml:id="dt-implementation-dependent">An
<firstterm>implementation-dependent</firstterm> feature is one where the
implementation has discretion in how it is performed.
Implementations are not required to document or explain
how <glossterm role="unwrapped">implementation-dependent</glossterm> features are performed.</termdef>
</para>

<para><termdef xml:id="dt-implementation-defined">An
<firstterm>implementation-defined</firstterm> feature is one where the
implementation has discretion in how it is performed.
Conformant implementations <rfc2119>must</rfc2119> document
how <glossterm role="unwrapped">implementation-defined</glossterm> features are performed.</termdef>
</para>

<section xml:id="implementation-defined">
<title>Implementation-defined features</title>

<para>The following features are implementation-defined:</para>

<?implementation-defined-features?>
</section>

</appendix>

  <appendix xml:id="references">
    <title>References</title>
    <bibliolist>
      <bibliomixed xml:id="id-draft-klyne"/>
      <bibliomixed xml:id="xproc31"/>
    </bibliolist>
  </appendix>

  <!-- This glossary will automatically be elided if there are no
     terms marked up as 'firstterm's in this specification. -->
  
      <glossary xml:id="glossary">
        <title>Glossary</title>
        <para>Glossary needs to be generated</para>
      </glossary>
    

  <appendix version="5.0-extension w3c-xproc" xml:id="ancillary-files">
<title>Ancillary files</title>

<para>This specification includes by reference a number of
ancillary files.</para>

<variablelist>
<varlistentry>
<term><link xlink:href="steps.xpl"/></term>
<listitem>
<para>An XProc step library for the declared steps.
</para>
</listitem>
</varlistentry>
</variablelist>

</appendix>

</specification>