Create the form

The form must contain the following elements:

  • recipients. Comma-separated list of email-adresses

  • sender. Can also be specified in the mailSender component

  • mailType. defines what content to send. Chose between these types: text_plain,text_html,html_url,html_mixed.

  • Depending on the mailType the folowing elements must be included

  • text_plain: plainContent. Will be sent with content-type 'text/plain'

  • text_html: plainContent and htmlContent. Will send a 'multipart/alternative' message with plainContent as 'text/plain' and htmlContent as 'text/html' The client mailreader will choose what content to display

  • html_url: plainContent and url. Works the same way as text_html, but the 'text/html' part will contain the content of the specified url.

  • html_mixed: plainContent,url and attachments Works the same way as html_url, but attachments can be included (comma-separated list of filenames)

  • The following elements are optional

  • -subject

  • -ccRecipients

  • -bccrecipients

<%@ page language="java"  %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>

<html:form action="sendform?method=sendFormAsMail">
  <html:hidden property="mailType" value="text_plain|text_html|html_url|html_mixed"/>
  <html:hidden property="plainContent" value="This is plain text"/>
  <html:hidden property="htmlContent" value="this is html"/>
  <html:hidden property="url" value="http://thisisaurl.com/"/>
  <html:hidden property="attachments" value="c:\attachment.txt,c:\attachment2.txt"/>
  recipients: <html:text property="recipients" size="20" value=""/><br/>
  cc recipients: <html:text property="ccRecipients" size="20" value=""/><br/>
  bcc recipients: <html:text property="bccRecipients" size="20" value=""/><br/>
  Subject: <html:text property="subject" size="20"/><br/>
  <p/>
  <html:submit></html:submit>
</html:form>