<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<xsp:page language="java"
          xmlns:xsp="http://apache.org/xsp"
          xmlns:xsp-request="http://apache.org/xsp/request/2.0">
<page>
  <resources>
    <resource type="doc" href="http://cocoon.apache.org/2.1/userdocs/optional/sendmail-action.html">Actions</resource>
    <resource type="doc" href="http://cocoon.apache.org/2.1/userdocs/logicsheets/sendmail.html">Logicsheet</resource>
  </resources>

  <title>Send EMail</title>

  <p>
    You can choose which frontend is used to actually compose the email.
    The old action is only kept for compatibility and does not support
    attachments. Migrating to the new action is very painless however: only
    reading request parameters is not supported by the new action anymore
    since this can easily be done with input modules from sitemap.
  </p>

  <p>
    The default installation of Apache Cocoon does not allow
    uploads. This feature needs to be enabled in web.xml
  </p>

  <p>
    Sending email from this sample is restricted to clients accessing the
    server as "localhost". So even if the client runs on the same host, it
    does not work if the URL is not "http://<b>localhost</b>..." The sample
    silently fails otherwise.
  </p>

  <p style="color:red;">
    <xsp-request:get-attribute name="org.apache.cocoon.acting.Sendmail" default=""/>
  </p>

  <table cellpadding="2" cellspacing="2" border="0">
    <tbody>
      <form method="POST" enctype="multipart/form-data">
        <tr>
          <td valign="Top" align="Right">SMTP Host</td>
          <td valign="Top">
            <input type="text" name="smtphost" value=""/>
          </td>
          <td />
        </tr>
        <tr>
          <td valign="Top" align="Right">SMTP User</td>
          <td valign="Top">
            <input type="text" name="smtpuser" value=""/>
          </td>
          <td />
        </tr>
        <tr>
          <td valign="Top" align="Right">SMTP Password</td>
          <td valign="Top">
            <input type="password" name="smtppassword" value=""/>
          </td>
          <td />
        </tr>

        <tr>
          <td valign="Top" align="Right">From</td>
          <td valign="Top">
            <input type="text" name="from" value="cocoon@localhost"/>
          </td>
          <td />
        </tr>
        <tr>
          <td valign="Top" align="Right">To</td>
          <td valign="Top">
            <input type="text" name="to" value="@localhost"/>
          </td>
          <td />
        </tr>
        <tr>
          <td valign="Top" align="Right">CC</td>
          <td valign="Top">
            <input type="text" name="cc"/>
          </td>
          <td />
        </tr>
        <tr>
          <td valign="Top" align="Right">BCC</td>
          <td valign="Top">
            <input type="text" name="bcc"/>
          </td>
          <td />
        </tr>
        <tr>
          <td valign="Top" align="Right">Subject</td>
          <td valign="Top">
            <input type="text" name="subject"/>
          </td>
          <td />
        </tr>
        <tr>
          <td valign="Top" align="Right">Body</td>
          <td valign="Top">
            <textarea name="body" rows="10" cols="72"/>
          </td>
          <td />
        </tr>
        <tr>
          <td valign="Top" align="Right">File to attach</td>
          <td valign="Top">
            <input type="file" name="attachment"/>
          </td>
          <td/>
        </tr>
        <tr>
          <td>Choose the frontend:</td>
          <td>Send mail using
            <input type="submit" name="use-flow" value="Flow"/>
            <input type="submit" name="use-action" value="Action"/>
            <input type="submit" name="use-oldaction" value="Deprecated Action"/>
            <input type="submit" name="use-logicsheet" value="Logicsheet"/>
          </td>
          <td/>
        </tr>
      </form>
    </tbody>
  </table>

</page>
</xsp:page>
