You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by vg...@apache.org on 2006/10/30 22:02:49 UTC
svn commit: r469274 - in /cocoon/trunk/blocks/cocoon-mail:
cocoon-mail-impl/src/main/java/org/apache/cocoon/acting/
cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/
cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/datasource/
cocoon-mail-sam...
Author: vgritsenko
Date: Mon Oct 30 13:02:48 2006
New Revision: 469274
URL: http://svn.apache.org/viewvc?view=rev&rev=469274
Log:
from branch:
<action dev="VG" type="update">
Mail: Improve MailSender interface: added setBody(Object), setBodyURL
methods, deprecated setCharset, setBody(String), setBodyFromSrc,
setBodyFromSrcMimeType methods. Support byte[], InputStream as body and
attachment objects.
</action>
Added:
cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/datasource/AbstractDataSource.java
- copied unchanged from r469261, cocoon/branches/BRANCH_2_1_X/src/blocks/mail/java/org/apache/cocoon/mail/datasource/AbstractDataSource.java
cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/datasource/InputStreamDataSource.java
- copied unchanged from r469261, cocoon/branches/BRANCH_2_1_X/src/blocks/mail/java/org/apache/cocoon/mail/datasource/InputStreamDataSource.java
cocoon/trunk/blocks/cocoon-mail/cocoon-mail-sample/src/main/resources/COB-INF/sendmail/mail.js
- copied unchanged from r469261, cocoon/branches/BRANCH_2_1_X/src/blocks/mail/samples/sendmail/mail.js
Modified:
cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/acting/Sendmail.java
cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/MailMessageSender.java
cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/MailSender.java
cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/datasource/FilePartDataSource.java
cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/datasource/SourceDataSource.java
cocoon/trunk/blocks/cocoon-mail/cocoon-mail-sample/src/main/resources/COB-INF/sendmail/form.xml
cocoon/trunk/blocks/cocoon-mail/cocoon-mail-sample/src/main/resources/COB-INF/sendmail/sitemap.xmap
Modified: cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/acting/Sendmail.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/acting/Sendmail.java?view=diff&rev=469274&r1=469273&r2=469274
==============================================================================
--- cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/acting/Sendmail.java (original)
+++ cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/acting/Sendmail.java Mon Oct 30 13:02:48 2006
@@ -205,18 +205,22 @@
if (parameters.isParameter("subject")) {
mms.setSubject(parameters.getParameter("subject", null));
}
- if (parameters.isParameter("charset")) {
- mms.setCharset(parameters.getParameter("charset", null));
- }
- if (parameters.isParameter("src")) {
- mms.setBodyFromSrc(parameters.getParameter("src", null));
+ String bodyURL = parameters.getParameter("src", "");
+ String body = parameters.getParameter("body", "");
+ if (bodyURL.length() > 0) {
+ String type = null;
if (parameters.isParameter("srcMimeType")) {
- mms.setBodyFromSrcMimeType(
- parameters.getParameter("srcMimeType", null));
+ type = parameters.getParameter("srcMimeType", null);
+ }
+ mms.setBodyURL(bodyURL, type);
+ } else if (body.length() > 0) {
+ String type = null;
+ String charset = parameters.getParameter("charset", "");
+ if (charset.length() > 0) {
+ type = "text/plain; charset=" + charset;
}
- } else if (parameters.isParameter("body")) {
- mms.setBody(parameters.getParameter("body", null));
+ mms.setBody(body, type);
}
if (parameters.isParameter("attachments")) {
@@ -231,9 +235,7 @@
getLogger().debug("request-attachment: " + obj);
}
} else {
- mms.addAttachmentURL(srcName,
- null,
- srcName.substring(srcName.lastIndexOf('/') + 1));
+ mms.addAttachmentURL(srcName);
if (getLogger().isDebugEnabled()) {
getLogger().debug("sitemap-attachment: " + srcName);
}
Modified: cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/MailMessageSender.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/MailMessageSender.java?view=diff&rev=469274&r1=469273&r2=469274
==============================================================================
--- cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/MailMessageSender.java (original)
+++ cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/MailMessageSender.java Mon Oct 30 13:02:48 2006
@@ -16,27 +16,17 @@
*/
package org.apache.cocoon.mail;
-import org.apache.avalon.framework.CascadingRuntimeException;
-import org.apache.avalon.framework.activity.Initializable;
-import org.apache.avalon.framework.configuration.Configurable;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.Serviceable;
-
-import org.apache.cocoon.mail.datasource.FilePartDataSource;
-import org.apache.cocoon.mail.datasource.SourceDataSource;
-import org.apache.cocoon.servlet.multipart.Part;
-
-import org.apache.excalibur.source.Source;
-import org.apache.excalibur.source.SourceResolver;
-
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
import javax.activation.DataHandler;
import javax.activation.DataSource;
import javax.mail.Authenticator;
-import javax.mail.BodyPart;
import javax.mail.Message.RecipientType;
import javax.mail.MessagingException;
import javax.mail.Multipart;
@@ -48,13 +38,26 @@
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Properties;
+import javax.mail.internet.MimePart;
+
+import org.apache.avalon.framework.CascadingRuntimeException;
+import org.apache.avalon.framework.activity.Initializable;
+import org.apache.avalon.framework.configuration.Configurable;
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.ConfigurationException;
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.avalon.framework.logger.Logger;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.Serviceable;
+import org.apache.excalibur.source.Source;
+import org.apache.excalibur.source.SourceResolver;
+
+import org.apache.cocoon.mail.datasource.AbstractDataSource;
+import org.apache.cocoon.mail.datasource.FilePartDataSource;
+import org.apache.cocoon.mail.datasource.InputStreamDataSource;
+import org.apache.cocoon.mail.datasource.SourceDataSource;
+import org.apache.cocoon.servlet.multipart.Part;
/**
* A helper class used by the {@link org.apache.cocoon.acting.Sendmail}
@@ -88,17 +91,33 @@
private String cc;
private String bcc;
private String subject;
- private String charset;
- private String src;
- private String srcMimeType;
- private String body;
+
+ private Attachment body;
+ private String bodyType;
+ private String bodySrcType;
private List attachments;
+
private Exception exception;
+
+ /** Java 1.3 Accessor */
+ private Logger getMyLogger() {
+ return getLogger();
+ }
+
+ /**
+ * Check string for null, empty, and "null".
+ * @param str
+ * @return true if str is null, empty string, or equals "null"
+ */
+ private boolean isNullOrEmpty(String str) {
+ return str == null || "".equals(str) || "null".equals(str);
+ }
+
/**
* Helper class for attachment data.
*/
- private static class Attachment {
+ private class Attachment {
private Object obj;
private String type;
private String name;
@@ -134,24 +153,17 @@
this.type = type;
this.name = name;
this.isURL = isURI;
+
if (isNullOrEmpty(this.type)) {
this.type = null;
}
+
if (isNullOrEmpty(this.name)) {
this.name = null;
}
}
/**
- * Check String for null or empty.
- * @param str
- * @return true if str is null, empty string, or equals "null"
- */
- private boolean isNullOrEmpty(String str) {
- return str == null || "".equals(str) || "null".equals(str);
- }
-
- /**
* Is the encapsulated object a URL?
* @return true if URL
*/
@@ -160,21 +172,25 @@
}
/**
- * Return attachment name. The argument overrides the stored name.
- * @param name
- * @return stored name or otherwise parameter
+ * Is the encapsulated object a text?
+ * @return true if text (String object)
*/
- public String getName(String name) {
- return (this.name == null ? name : this.name);
+ public boolean isText() {
+ return !isURL() && this.obj instanceof String;
}
/**
- * Return attachment type. The argument overrides the stored type.
- * @param type attachment type
- * @return stored type or otherwise parameter
+ * Return attachment name.
*/
- public String getType(String type) {
- return (this.type == null ? type : this.type);
+ public String getName() {
+ return this.name;
+ }
+
+ /**
+ * Return attachment type.
+ */
+ public String getType() {
+ return this.type;
}
/**
@@ -183,6 +199,94 @@
public Object getObject() {
return this.obj;
}
+
+ public String getText() {
+ return (String) this.obj;
+ }
+
+ public DataSource getDataSource(SourceResolver resolver, List sources)
+ throws IOException, MessagingException {
+ AbstractDataSource ds = null;
+
+ if (isURL) {
+ String url = (String) getObject();
+ Source src = resolver.resolveURI(url);
+ sources.add(src);
+ if (src.exists()) {
+ ds = new SourceDataSource(src, getType(), getName());
+ }
+ } else if (getObject() instanceof Part) {
+ Part part = (Part) getObject();
+ ds = new FilePartDataSource(part, getType(), getName());
+ } else if (getObject() instanceof InputStream) {
+ InputStream in = (InputStream) getObject();
+ ds = new InputStreamDataSource(in, getType(), getName());
+ } else if (getObject() instanceof byte[]) {
+ byte[] data = (byte[]) getObject();
+ ds = new InputStreamDataSource(data, getType(), getName());
+ } else {
+ // TODO: other classes?
+ throw new MessagingException("Not yet supported: " + getObject());
+ }
+
+ if (ds != null) {
+ ds.enableLogging(getMyLogger());
+ }
+ return ds;
+ }
+
+ public void setContentTo(SourceResolver resolver, List sources, MimePart part)
+ throws IOException, MessagingException {
+ if (isText()) {
+ // Set text
+ if (type != null) {
+ part.setContent(getText(), type);
+ } else {
+ // Let JavaMail decide on character encoding.
+ part.setText(getText());
+ }
+ if (name != null) {
+ part.setFileName(name);
+ }
+ } else {
+ // Set data
+ DataSource ds = getDataSource(resolver, sources);
+ part.setDataHandler(new DataHandler(ds));
+ String name = ds.getName();
+ if (name != null) {
+ part.setFileName(name);
+ }
+ }
+ }
+
+ public MimeBodyPart getBodyPart(SourceResolver resolver, List sources)
+ throws IOException, MessagingException {
+ MimeBodyPart part = new MimeBodyPart();
+ setContentTo(resolver, sources, part);
+ return part;
+ }
+ }
+
+ private class Body extends Attachment {
+ public Body(Object obj) {
+ super(obj);
+ }
+
+ public Body(Object obj, String type) {
+ super(obj, type, null);
+ }
+
+ public Body(Object obj, String type, boolean isURI) {
+ super(obj, type, null, isURI);
+ }
+
+ // Override to set name to null: body can not have name.
+ public DataSource getDataSource(SourceResolver resolver, List sources)
+ throws IOException, MessagingException {
+ AbstractDataSource ds = (AbstractDataSource) super.getDataSource(resolver, sources);
+ ds.setName(null);
+ return ds;
+ }
}
@@ -190,8 +294,9 @@
}
/**
- * Creates a new instance of MailMessageSender
+ * Creates a new instance of MailMessageSender.
* Keep constructor for backwards compatibility.
+ *
* @param smtpHost The host name or ip-address of a host to accept
* the email for delivery.
* @deprecated Since 2.1.5. Please use {@link MailSender} component instead.
@@ -206,18 +311,12 @@
this.manager = manager;
}
- /* (non-Javadoc)
- * @see Parameterizable#parameterize(Parameters)
- */
public void configure(Configuration config) throws ConfigurationException {
this.smtpHost = config.getChild("smtp-host").getValue(null);
this.smtpUser = config.getChild("smtp-user").getValue(null);
this.smtpPswd = config.getChild("smtp-password").getValue(null);
}
- /* (non-Javadoc)
- * @see Initializable#initialize()
- */
public void initialize() {
initSession();
this.attachments = new ArrayList();
@@ -259,6 +358,7 @@
/**
* Assemble the message from the defined fields and send it.
+ *
* @throws AddressException when problems with email addresses are found
* @throws MessagingException when message could not be send.
*/
@@ -276,6 +376,7 @@
/**
* Assemble the message from the defined fields and send it.
+ *
* @throws AddressException when problems with email addresses are found
* @throws MessagingException when message could not be send.
* @deprecated Since 2.1.5. Use {@link #send()} which doesn't require passing the source resolver
@@ -288,7 +389,6 @@
private void doSend(SourceResolver resolver)
throws AddressException, MessagingException {
- final List sourcesList = new ArrayList();
final MimeMessage message = new MimeMessage(this.session);
@@ -351,100 +451,43 @@
message.setSentDate(new Date());
Attachment a = null;
+ final List sources = new ArrayList();
try {
if (this.attachments.isEmpty()) {
- if (this.src != null) {
- SourceDataSource ds = null;
-
- Source source = resolver.resolveURI(this.src);
- sourcesList.add(source);
- if (source.exists()) {
- ds = new SourceDataSource(source,
- this.srcMimeType == null? source.getMimeType(): this.srcMimeType,
- this.src.substring(this.src.lastIndexOf('/') + 1));
- ds.enableLogging(getLogger());
- }
-
- message.setDataHandler(new DataHandler(ds));
-
- } else if (this.body != null) {
- if (this.charset != null) {
- message.setText(this.body, this.charset);
- } else {
- message.setText(this.body);
- }
+ // Message consists of single part
+ if (this.body != null) {
+ a = this.body;
+ a.setContentTo(resolver, sources, message);
}
} else {
+ // Message consists of multiple parts
Multipart multipart = new MimeMultipart();
- BodyPart bodypart = new MimeBodyPart();
- multipart.addBodyPart(bodypart);
message.setContent(multipart);
- if (this.src != null) {
- SourceDataSource ds = null;
-
- Source source = resolver.resolveURI(this.src);
- sourcesList.add(source);
- if (source.exists()) {
- ds = new SourceDataSource(source,
- this.srcMimeType == null? source.getMimeType(): this.srcMimeType,
- this.src.substring(this.src.lastIndexOf('/') + 1));
- ds.enableLogging(getLogger());
- }
-
- bodypart.setDataHandler(new DataHandler(ds));
- bodypart.setFileName(ds.getName());
-
- } else if (this.body != null) {
- bodypart.setText(this.body);
+ // Body part
+ if (this.body != null) {
+ a = this.body;
+ multipart.addBodyPart(a.getBodyPart(resolver, sources));
}
+ // Attachment parts
for (Iterator i = this.attachments.iterator(); i.hasNext();) {
a = (Attachment) i.next();
- DataSource ds = null;
-
- if (a.isURL) {
- String name = (String) a.getObject();
- Source src = resolver.resolveURI(name);
- sourcesList.add(src);
- if (src.exists()) {
- ds = new SourceDataSource(src,
- a.getType(src.getMimeType()),
- a.getName(name.substring(name.lastIndexOf('/') + 1)));
- ((SourceDataSource) ds).enableLogging(getLogger());
- }
- } else {
- if (a.getObject() instanceof Part) {
- Part part = (Part) a.getObject();
- ds = new FilePartDataSource(part,
- a.getType(part.getMimeType()),
- a.getName(part.getUploadName()));
- } else {
- // TODO: other classes?
- throw new AddressException("Not yet supported: " + a.getObject());
- }
- }
-
- bodypart = new MimeBodyPart();
- bodypart.setDataHandler(new DataHandler(ds));
- bodypart.setFileName(ds.getName());
- multipart.addBodyPart(bodypart);
+ multipart.addBodyPart(a.getBodyPart(resolver, sources));
}
}
message.saveChanges();
Transport.send(message);
} catch (MalformedURLException e) {
- throw new AddressException("Malformed attachment URL: " +
- a.getObject() + " error " + e.getMessage());
+ throw new MessagingException("Malformed attachment URL: " +
+ a.getObject() + " error " + e.getMessage());
} catch (IOException e) {
- throw new AddressException("IOException accessing attachment URL: " +
- a.getObject() + " error " + e.getMessage());
+ throw new MessagingException("IOException accessing attachment URL: " +
+ a.getObject() + " error " + e.getMessage());
} finally {
- if (sourcesList != null) {
- for (Iterator j = sourcesList.iterator(); j.hasNext();) {
- resolver.release((Source) j.next());
- }
+ for (Iterator j = sources.iterator(); j.hasNext();) {
+ resolver.release((Source) j.next());
}
}
}
@@ -452,6 +495,7 @@
/**
* Invokes the {@link #send()} method but catches any exception thrown. This
* method is intended to be used from the sendmail logicsheet.
+ *
* @return true when successful
*/
public boolean sendIt() {
@@ -494,11 +538,12 @@
/**
- * Set the <CODE>from</CODE> address of the message.
+ * Set the <code>from</code> address of the message.
+ *
* @param from The address the message appears to be from.
*/
public void setFrom(String from) {
- if (!("".equals(from) || "null".equals(from))) {
+ if (!isNullOrEmpty(from)) {
this.from = from.trim();
}
}
@@ -508,11 +553,12 @@
* is in the format, that
* {@link javax.mail.internet.InternetAddress#parse(String)} can handle
* (one or more email addresses separated by a commas).
+ *
* @param to the destination address(es)
* @see javax.mail.internet.InternetAddress#parse(String)
*/
public void setTo(String to) {
- if (!("".equals(to) || "null".equals(to))) {
+ if (!isNullOrEmpty(to)) {
this.to = to.trim();
}
}
@@ -522,11 +568,12 @@
* is in the format, that
* {@link javax.mail.internet.InternetAddress#parse(String)} can handle
* (one or more email addresses separated by a commas).
+ *
* @param replyTo the address(es) that replies should be sent to
* @see javax.mail.internet.InternetAddress#parse(String)
*/
public void setReplyTo(String replyTo) {
- if (!("".equals(replyTo) || "null".equals(replyTo))) {
+ if (!isNullOrEmpty(replyTo)) {
this.replyTo = replyTo.trim();
}
}
@@ -536,11 +583,12 @@
* message. The address is in the format, that
* {@link javax.mail.internet.InternetAddress#parse(String)} can handle
* (one or more email addresses separated by a commas).
+ *
* @param cc the address(es), which should receive a carbon copy.
* @see javax.mail.internet.InternetAddress#parse(String)
*/
public void setCc(String cc) {
- if (!("".equals(cc) || "null".equals(cc))) {
+ if (!isNullOrEmpty(cc)) {
this.cc = cc.trim();
}
}
@@ -550,33 +598,39 @@
* the message. The address is in the format, that
* {@link javax.mail.internet.InternetAddress#parse(String)} can handle
* (one or more email addresses separated by a commas).
+ *
* @param bcc the address(es), which should receive a black carbon copy.
* @see javax.mail.internet.InternetAddress#parse(String)
*/
public void setBcc(String bcc) {
- if (!("".equals(bcc) || "null".equals(bcc))) {
+ if (!isNullOrEmpty(bcc)) {
this.bcc = bcc.trim();
}
}
/**
- * Sets the character set for encoding the message. This has no effect,
- * if any attachments are send in the message.
- * @param charset the character set to be used for enbcoding the message
+ * Sets the subject line of the message.
+ *
+ * @param subject the subject line of the message
*/
- public void setCharset(String charset) {
- if (!("".equals(charset) || "null".equals(charset))) {
- this.charset = charset.trim();
+ public void setSubject(String subject) {
+ if (!isNullOrEmpty(subject)) {
+ this.subject = subject;
}
}
/**
- * Sets the subject line of the message.
- * @param subject the subject line of the message
+ * Sets the character set for encoding the message. This has no effect,
+ * if any attachments are send in the message.
+ *
+ * @param charset the character set to be used for enbcoding the message
*/
- public void setSubject(String subject) {
- if (!("".equals(subject) || "null".equals(subject))) {
- this.subject = subject;
+ public void setCharset(String charset) {
+ if (!isNullOrEmpty(charset)) {
+ this.bodyType = "text/plain; charset=" + charset.trim();
+ if (this.body != null && this.body.isText() && this.body.type == null) {
+ this.body.type = this.bodyType;
+ }
}
}
@@ -586,10 +640,11 @@
* only the latter will be used.
*
* @param body The body text of the email message
+ * @deprecated Since 2.1.10. Use {@link #setBody(Object)}
*/
public void setBody(String body) {
- if (!("".equals(body) || "null".equals(body))) {
- this.body = body;
+ if (!isNullOrEmpty(body)) {
+ setBody(body, bodyType);
}
}
@@ -599,31 +654,91 @@
* only the latter will be used.
*
* @param src The body source URL of the email message
+ * @deprecated Since 2.1.10. Use {@link #setBodyURL(String)}
*/
public void setBodyFromSrc(String src) {
- if (!("".equals(src) || "null".equals(src))) {
- this.src = src;
+ if (!isNullOrEmpty(src)) {
+ setBodyURL(src, bodySrcType);
}
}
/**
* Sets the optional body source Mime Type of the email message.
+ *
* @param srcMimeType The optional body source Mime Type of the email message
+ * @deprecated Since 2.1.10. Use {@link #setBodyURL(String, String)}
*/
public void setBodyFromSrcMimeType(String srcMimeType) {
- if (!("".equals(srcMimeType) || "null".equals(srcMimeType))) {
- this.srcMimeType = srcMimeType;
+ if (!isNullOrEmpty(srcMimeType)) {
+ this.bodySrcType = srcMimeType;
+ // Pass into this.body if it was set.
+ if (this.body != null && this.body.isURL() && this.body.type == null) {
+ this.body.type = srcMimeType;
+ }
}
}
/**
- * Add an attachement to the message to be send. The attachment can
- * be of type <CODE>org.apache.excalibur.source.Source</CODE> or
- * {@link org.apache.cocoon.servlet.multipart.Part} or its
- * subclasses.
- * @param attachment to be send with the message
+ * Sets the body content of the email message.
+ *
+ * <p>The body can be any of: {@link org.apache.excalibur.source.Source},
+ * {@link org.apache.cocoon.servlet.multipart.Part}, {@link java.io.InputStream},
+ * <code>byte[]</code>, {@link String}, or a subclass.
+ *
+ * @param body The body text of the email message
+ */
+ public void setBody(Object body) {
+ setBody(body, null);
+ }
+
+ /**
+ * Sets the body content of the email message.
+ *
+ * <p>The body can be any of: {@link org.apache.excalibur.source.Source},
+ * {@link org.apache.cocoon.servlet.multipart.Part}, {@link java.io.InputStream},
+ * <code>byte[]</code>, {@link String}, or a subclass.
+ *
+ * @param body The body text of the email message
+ * @param type mime type (optional)
+ */
+ public void setBody(Object body, String type) {
+ if (body != null) {
+ this.body = new Body(body, type);
+ }
+ }
+
+ /**
+ * Sets the body content of the email message.
+ *
+ * @param url URL to use as message body
* @see org.apache.excalibur.source.Source
*/
+ public void setBodyURL(String url) {
+ setBodyURL(url, null);
+ }
+
+ /**
+ * Sets the body content of the email message.
+ *
+ * @param url URL to use as message body
+ * @param type mime type (optional)
+ * @see org.apache.excalibur.source.Source
+ */
+ public void setBodyURL(String url, String type) {
+ if (body != null) {
+ this.body = new Body(url, type, true);
+ }
+ }
+
+ /**
+ * Add an attachement to the message to be send.
+ *
+ * <p>The attachment can be any of: {@link org.apache.excalibur.source.Source},
+ * {@link org.apache.cocoon.servlet.multipart.Part}, {@link java.io.InputStream},
+ * <code>byte[]</code>, {@link String}, or a subclass.
+ *
+ * @param attachment to be send with the message
+ */
public void addAttachment(Object attachment) {
if (attachment != null) {
attachments.add(new Attachment(attachment));
@@ -631,14 +746,15 @@
}
/**
- * Add an attachement to the message to be send. The attachment can
- * be of type <CODE>org.apache.excalibur.source.Source</CODE> or
- * {@link org.apache.cocoon.servlet.multipart.Part} or its
- * subclasses.
+ * Add an attachement to the message to be send.
+ *
+ * <p>The attachment can be any of: {@link org.apache.excalibur.source.Source},
+ * {@link org.apache.cocoon.servlet.multipart.Part}, {@link java.io.InputStream},
+ * <code>byte[]</code>, {@link String}, or a subclass.
+ *
* @param attachment to be send with the message
* @param type mime type (optional)
* @param name attachment name (optional)
- * @see org.apache.excalibur.source.Source
*/
public void addAttachment(Object attachment, String type, String name) {
if (attachment != null) {
@@ -647,10 +763,8 @@
}
/**
- * Add an attachement to the message to be send. The attachment can
- * be of type <CODE>org.apache.excalibur.source.Source</CODE> or
- * {@link org.apache.cocoon.servlet.multipart.Part} or its
- * subclasses.
+ * Add an attachement to the message to be send.
+ *
* @param url URL to attach to the message
* @see org.apache.excalibur.source.Source
*/
@@ -661,10 +775,8 @@
}
/**
- * Add an attachement to the message to be send. The attachment can
- * be of type <CODE>org.apache.excalibur.source.Source</CODE> or
- * {@link org.apache.cocoon.servlet.multipart.Part} or its
- * subclasses.
+ * Add an attachement to the message to be send.
+ *
* @param url URL to attach to the message
* @param type mime type (optional)
* @param name attachment name (optional)
Modified: cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/MailSender.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/MailSender.java?view=diff&rev=469274&r1=469273&r2=469274
==============================================================================
--- cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/MailSender.java (original)
+++ cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/MailSender.java Mon Oct 30 13:02:48 2006
@@ -16,13 +16,18 @@
*/
package org.apache.cocoon.mail;
-import org.apache.cocoon.environment.SourceResolver;
import javax.mail.MessagingException;
import javax.mail.internet.AddressException;
+import org.apache.cocoon.environment.SourceResolver;
+
/**
* A helper component used by the {@link org.apache.cocoon.acting.Sendmail}
- * and the <code>sendmail.xsl</code> logicsheet for sending an email message.
+ * action and the <code>sendmail.xsl</code> logicsheet for sending email messages.
+ *
+ * <p>Please note that this component is not (and can not) be
+ * {@link org.apache.avalon.framework.thread.ThreadSafe}, so you need to lookup
+ * new instance in each processing thread.
*
* @since 2.1.5
* @version $Id$
@@ -51,6 +56,7 @@
/**
* Set the <code>from</code> address of the message.
+ *
* @param from The address the message appears to be from.
*/
void setFrom(String from);
@@ -60,6 +66,7 @@
* is in the format, that
* {@link javax.mail.internet.InternetAddress#parse(String)} can handle
* (one or more email addresses separated by a commas).
+ *
* @param to the destination address(es)
* @see javax.mail.internet.InternetAddress#parse(String)
*/
@@ -70,6 +77,7 @@
* is in the format, that
* {@link javax.mail.internet.InternetAddress#parse(String)} can handle
* (one or more email addresses separated by a commas).
+ *
* @param replyTo the address(es) that replies should be sent to
* @see javax.mail.internet.InternetAddress#parse(String)
*/
@@ -80,6 +88,7 @@
* message. The address is in the format, that
* {@link javax.mail.internet.InternetAddress#parse(String)} can handle
* (one or more email addresses separated by a commas).
+ *
* @param cc the address(es), which should receive a carbon copy.
* @see javax.mail.internet.InternetAddress#parse(String)
*/
@@ -90,29 +99,38 @@
* the message. The address is in the format, that
* {@link javax.mail.internet.InternetAddress#parse(String)} can handle
* (one or more email addresses separated by a commas).
+ *
* @param bcc the address(es), which should receive a black carbon copy.
* @see javax.mail.internet.InternetAddress#parse(String)
*/
void setBcc(String bcc);
/**
- * Sets the character set for encoding the message. This has no effect,
- * if any attachments are send in the message.
- * @param charset the character set to be used for enbcoding the message
- */
- void setCharset(String charset);
-
- /**
* Sets the subject line of the message.
* @param subject the subject line of the message
*/
void setSubject(String subject);
+ //
+ // Set the Body
+ //
+
+ /**
+ * Sets the character set for encoding the message. This has effect
+ * only on text set via {@link #setBody(String)}.
+ *
+ * @param charset the character set to be used for encoding the message
+ * @deprecated Since 2.1.10. Use {@link #setBody(Object, String)}
+ */
+ void setCharset(String charset);
+
/**
* Sets the body text of the email message.
* If both a text body and a body read from a source are set,
* only the latter will be used.
+ *
* @param body The body text of the email message
+ * @deprecated Since 2.1.10. Use {@link #setBody(Object)}
*/
void setBody(String body);
@@ -120,53 +138,99 @@
* Sets the body source URL of the email message.
* If both a text body and a body read from a source are set,
* only the latter will be used.
+ *
* @param src The body source URL of the email message
+ * @deprecated Since 2.1.10. Use {@link #setBodyURL(String)}
*/
void setBodyFromSrc(String src);
/**
* Sets the optional body source Mime Type of the email message.
+ *
* @param srcMimeType The optional body source Mime Type of the email message
+ * @deprecated Since 2.1.10. Use {@link #setBodyURL(String, String)}
*/
void setBodyFromSrcMimeType(String srcMimeType);
/**
- * Add an attachement to the message to be send. The attachment can
- * be of type <CODE>org.apache.excalibur.source.Source</CODE> or
- * {@link org.apache.cocoon.servlet.multipart.Part} or its
- * subclasses.
- * @param attachment to be send with the message
+ * Sets the body content of the email message.
+ *
+ * <p>The body can be any of: {@link org.apache.excalibur.source.Source},
+ * {@link org.apache.cocoon.servlet.multipart.Part}, {@link java.io.InputStream},
+ * <code>byte[]</code>, {@link String}, or a subclass.
+ *
+ * @param body The body text of the email message
+ */
+ void setBody(Object body);
+
+ /**
+ * Sets the body content of the email message.
+ *
+ * <p>The body can be any of: {@link org.apache.excalibur.source.Source},
+ * {@link org.apache.cocoon.servlet.multipart.Part}, {@link java.io.InputStream},
+ * <code>byte[]</code>, {@link String}, or a subclass.
+ *
+ * @param body The body text of the email message
+ * @param type mime type (optional)
+ */
+ void setBody(Object body, String type);
+
+ /**
+ * Sets the body content of the email message.
+ *
+ * @param url URL to use as message body
* @see org.apache.excalibur.source.Source
*/
+ void setBodyURL(String url);
+
+ /**
+ * Sets the body content of the email message.
+ *
+ * @param url URL to use as message body
+ * @param type mime type (optional)
+ * @see org.apache.excalibur.source.Source
+ */
+ void setBodyURL(String url, String type);
+
+ //
+ // Add Attachments
+ //
+
+ /**
+ * Add an attachement to the message to be send.
+ *
+ * <p>The attachment can be any of: {@link org.apache.excalibur.source.Source},
+ * {@link org.apache.cocoon.servlet.multipart.Part}, {@link java.io.InputStream},
+ * <code>byte[]</code>, {@link String}, or a subclass.
+ *
+ * @param attachment to be send with the message
+ */
void addAttachment(Object attachment);
/**
- * Add an attachement to the message to be send. The attachment can
- * be of type <CODE>org.apache.excalibur.source.Source</CODE> or
- * {@link org.apache.cocoon.servlet.multipart.Part} or its
- * subclasses.
+ * Add an attachement to the message to be send.
+ *
+ * <p>The attachment can be any of: {@link org.apache.excalibur.source.Source},
+ * {@link org.apache.cocoon.servlet.multipart.Part}, {@link java.io.InputStream},
+ * <code>byte[]</code>, {@link String}, or a subclass.
+ *
* @param attachment to be send with the message
* @param type mime type (optional)
* @param name attachment name (optional)
- * @see org.apache.excalibur.source.Source
*/
void addAttachment(Object attachment, String type, String name);
/**
- * Add an attachement to the message to be send. The attachment can
- * be of type <CODE>org.apache.excalibur.source.Source</CODE> or
- * {@link org.apache.cocoon.servlet.multipart.Part} or its
- * subclasses.
+ * Add an attachement to the message to be send.
+ *
* @param url URL to attach to the message
* @see org.apache.excalibur.source.Source
*/
void addAttachmentURL(String url);
/**
- * Add an attachement to the message to be send. The attachment can
- * be of type <CODE>org.apache.excalibur.source.Source</CODE> or
- * {@link org.apache.cocoon.servlet.multipart.Part} or its
- * subclasses.
+ * Add an attachement to the message to be send.
+ *
* @param url URL to attach to the message
* @param type mime type (optional)
* @param name attachment name (optional)
Modified: cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/datasource/FilePartDataSource.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/datasource/FilePartDataSource.java?view=diff&rev=469274&r1=469273&r2=469274
==============================================================================
--- cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/datasource/FilePartDataSource.java (original)
+++ cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/datasource/FilePartDataSource.java Mon Oct 30 13:02:48 2006
@@ -19,9 +19,6 @@
import java.io.IOException;
import java.io.InputStream;
-import java.io.OutputStream;
-
-import javax.activation.DataSource;
import org.apache.cocoon.servlet.multipart.Part;
@@ -32,11 +29,9 @@
* @see javax.activation.DataSource
* @version $Id$
*/
-public class FilePartDataSource implements DataSource {
+public class FilePartDataSource extends AbstractDataSource {
private Part part;
- private String contentType;
- private String name;
/**
* Creates a new instance of FilePartDataSource from an
@@ -53,75 +48,70 @@
* @param part An {@link Part} object.
*/
public FilePartDataSource(Part part, String type, String name) {
+ super(getName(name, part), getType(type, part));
this.part = part;
- this.contentType = type;
- this.name = name;
- if (isNullOrEmpty(this.name)) this.name = null;
- if (isNullOrEmpty(this.contentType)) this.contentType = null;
}
/**
- * Check String for null or empty.
- * @param str
- * @return true if str is null, empty string, or equals "null"
- */
- private boolean isNullOrEmpty(String str) {
- return (str == null || "".equals(str) || "null".equals(str));
- }
+ * Determines the name for this <code>DataSource</code> object.
+ * It is first non empty value from the list:
+ * <ul>
+ * <li>The value of <code>name</code> argument.
+ * <li>The value returned by the {@link Part#getFileName()}.
+ * <li>"attachment".
+ * </ul>
+ *
+ * @return the name for this <code>DataSource</code>
+ */
+ private static String getName(String name, Part part) {
+ if (isNullOrEmpty(name)) {
+ name = part.getFileName();
+ if (isNullOrEmpty(name)) {
+ name = "attachment";
+ }
+ }
+
+ return name;
+ }
/**
- * Return the content type (mime type) obtained from
- * {@link Part#getMimeType()}.
- * Return <CODE>application/octet-stream</CODE> if <CODE>getMimeType()</CODE>
- * returns <CODE>null</CODE>.
- * @return The content type (mime type) for this <CODE>DataSource</CODE> object.
- */
- public String getContentType() {
- if (this.contentType != null) {
- return this.contentType;
+ * Determines the mime type for this <code>DataSource</code> object.
+ * It is first non empty value from the list:
+ * <ul>
+ * <li>The value of <code>type</code> argument.
+ * <li>The value returned by {@link Part#getMimeType()}.
+ * <li>"application/octet-stream".
+ * </ul>
+ *
+ * @return The content type (mime type) of this <code>DataSource</code> object.
+ */
+ private static String getType(String type, Part part) {
+ if (isNullOrEmpty(type)) {
+ type = part.getMimeType();
+ if (isNullOrEmpty(type)) {
+ type = "application/octet-stream";
+ }
}
- String mimeType = part.getMimeType();
- if (isNullOrEmpty(mimeType)) {
- mimeType = "application/octet-stream";
- }
- return mimeType;
+
+ return type;
}
/**
- * The InputStream object obtained from
- * {@link Part#getInputStream()}
+ * The InputStream object obtained from {@link Part#getInputStream()}
* object.
+ *
* @throws java.io.IOException if an I/O error occurs.
- * @return The InputStream object for this <CODE>DataSource</CODE> object.
+ * @return The InputStream object for this <code>DataSource</code> object.
*/
public InputStream getInputStream() throws IOException {
- InputStream inp;
try {
- inp = part.getInputStream();
- } catch (Exception e) {
- throw new IOException(e.getMessage());
+ return part.getInputStream();
+ } catch (IOException e) {
+ // Sun's SMTPTransport looses cause exception. Log it now.
+ if (getLogger() != null) {
+ getLogger().warn("Unable to obtain input stream for '" + part.getUploadName() + "'", e);
+ }
+ throw e;
}
- return inp;
- }
-
- /**
- * Returns the name for this <CODE>DataSource</CODE> object. This is
- * what is returned by
- * {@link Part#getFileName()}.
- * @return the name for this <CODE>DataSource</CODE> object.
- */
- public String getName() {
- String name = (this.name != null ? this.name : part.getFileName());
- if (isNullOrEmpty(name)) name="attachment";
- return name;
- }
-
- /**
- * Unimplemented. Directly throws <CODE>IOException</CODE>.
- * @throws java.io.IOException since unimplemented
- * @return nothing
- */
- public OutputStream getOutputStream() throws IOException {
- throw new IOException("no data sink available");
}
}
Modified: cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/datasource/SourceDataSource.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/datasource/SourceDataSource.java?view=diff&rev=469274&r1=469273&r2=469274
==============================================================================
--- cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/datasource/SourceDataSource.java (original)
+++ cocoon/trunk/blocks/cocoon-mail/cocoon-mail-impl/src/main/java/org/apache/cocoon/mail/datasource/SourceDataSource.java Mon Oct 30 13:02:48 2006
@@ -18,10 +18,7 @@
import java.io.IOException;
import java.io.InputStream;
-import java.io.OutputStream;
-import javax.activation.DataSource;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.excalibur.source.Source;
/**
@@ -33,15 +30,13 @@
* @see javax.activation.DataSource
* @version $Id$
*/
-public class SourceDataSource extends AbstractLogEnabled
- implements DataSource {
+public class SourceDataSource extends AbstractDataSource {
private Source src;
- private String contentType;
- private String name;
/**
- * Creates a new instance of SourceDataSource
+ * Creates a new instance of SourceDataSource.
+ *
* @param src A <code>org.apache.excalibur.source.Source</code> Object.
*/
public SourceDataSource(Source src) {
@@ -49,54 +44,70 @@
}
/**
- * Creates a new instance of SourceDataSource
+ * Creates a new instance of SourceDataSource.
+ *
* @param src A <code>org.apache.excalibur.source.Source</code> Object.
*/
public SourceDataSource(Source src, String type, String name) {
+ super(getName(name, src), getType(type, src));
this.src = src;
- this.contentType = type;
- this.name = name;
- if (isNullOrEmpty(this.name)) {
- this.name = null;
- }
- if (isNullOrEmpty(this.contentType)) {
- this.contentType = null;
- }
}
/**
- * Check String for null or empty.
- * @param str
- * @return true if str is null, empty string, or equals "null"
+ * Determines the name for this <code>DataSource</code> object.
+ * It is first non empty value from the list:
+ * <ul>
+ * <li>The value of <code>name</code> argument.
+ * <li>The last path component (after the last '/') from the value
+ * returned by the {@link Source#getURI()}.
+ * <li>"attachment".
+ * </ul>
+ *
+ * @return the name for this <code>DataSource</code>
*/
- private boolean isNullOrEmpty(String str) {
- return str == null || "".equals(str) || "null".equals(str);
- }
+ private static String getName(String name, Source src) {
+ if (isNullOrEmpty(name)) {
+ name = src.getURI();
+ name = name.substring(name.lastIndexOf('/') + 1);
+ int idx = name.indexOf('?');
+ if (idx > -1) {
+ name = name.substring(0, idx);
+ }
+
+ if (isNullOrEmpty(name)) {
+ name = "attachment";
+ }
+ }
+
+ return name;
+ }
/**
- * Returns the result of a call to the <code>Source</code>
- * objects <code>getMimeType()</code> method. Returns
- * "application/octet-stream", if <code>getMimeType()</code>
- * returns <code>null</code>.
+ * Determines the mime type for this <code>DataSource</code> object.
+ * It is first non empty value from the list:
+ * <ul>
+ * <li>The value of <code>type</code> argument.
+ * <li>The value returned by {@link Source#getMimeType()}.
+ * <li>"application/octet-stream".
+ * </ul>
+ *
* @return The content type (mime type) of this <code>DataSource</code> object.
- * @see org.apache.excalibur.source.Source#getMimeType()
*/
- public String getContentType() {
- if (this.contentType != null) {
- return this.contentType;
- }
-
- String mimeType = src.getMimeType();
- if (isNullOrEmpty(mimeType)) {
- mimeType = "application/octet-stream";
+ private static String getType(String type, Source src) {
+ if (isNullOrEmpty(type)) {
+ type = src.getMimeType();
+ if (isNullOrEmpty(type)) {
+ type = "application/octet-stream";
+ }
}
- return mimeType;
+ return type;
}
/**
* Get the <code>InputStream</code> object from the
* <code>Source</code> object.
+ *
* @throws java.io.IOException if an I/O error occurs.
* @return The InputStream object from the <code>Source</code> object.
* @see org.apache.excalibur.source.Source#getInputStream()
@@ -111,32 +122,5 @@
}
throw e;
}
- }
-
- /**
- * Returns the name for this <code>DataSource</code> object. This is
- * actually the last path component (after the last '/') from the value
- * returned by the <code>getURI()</code> method of the <code>Source</code>
- * object.
- * @return the name for this <code>DataSource</code>
- * @see org.apache.excalibur.source.Source#getURI()
- */
- public String getName() {
- if (this.name != null){
- return this.name;
- }
-
- String name = src.getURI();
- name = name.substring(name.lastIndexOf('/') + 1);
- return "".equals(name)? "attachment" : name;
- }
-
- /**
- * Unimplemented. Directly throws <code>IOException</code>.
- * @throws java.io.IOException since unimplemented
- * @return nothing
- */
- public OutputStream getOutputStream() throws IOException {
- throw new IOException("no data sink available");
}
}
Modified: cocoon/trunk/blocks/cocoon-mail/cocoon-mail-sample/src/main/resources/COB-INF/sendmail/form.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-mail/cocoon-mail-sample/src/main/resources/COB-INF/sendmail/form.xml?view=diff&rev=469274&r1=469273&r2=469274
==============================================================================
--- cocoon/trunk/blocks/cocoon-mail/cocoon-mail-sample/src/main/resources/COB-INF/sendmail/form.xml (original)
+++ cocoon/trunk/blocks/cocoon-mail/cocoon-mail-sample/src/main/resources/COB-INF/sendmail/form.xml Mon Oct 30 13:02:48 2006
@@ -127,6 +127,7 @@
<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"/>
Modified: cocoon/trunk/blocks/cocoon-mail/cocoon-mail-sample/src/main/resources/COB-INF/sendmail/sitemap.xmap
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-mail/cocoon-mail-sample/src/main/resources/COB-INF/sendmail/sitemap.xmap?view=diff&rev=469274&r1=469273&r2=469274
==============================================================================
--- cocoon/trunk/blocks/cocoon-mail/cocoon-mail-sample/src/main/resources/COB-INF/sendmail/sitemap.xmap (original)
+++ cocoon/trunk/blocks/cocoon-mail/cocoon-mail-sample/src/main/resources/COB-INF/sendmail/sitemap.xmap Mon Oct 30 13:02:48 2006
@@ -73,13 +73,25 @@
</map:resource>
</map:resources>
+ <map:flow language="javascript">
+ <map:script src="mail.js"/>
+ </map:flow>
+
<!-- =========================== Pipelines ================================= -->
<map:pipelines>
<map:pipeline>
+ <map:match pattern="view/page">
+ <map:call resource="show-page">
+ <map:parameter name="target" value="done.xml"/>
+ <map:parameter name="remove" value="ignored"/>
+ </map:call>
+ </map:match>
+
<map:match pattern="*">
<map:match type="host-matcher" pattern="localhost">
+
<!--+
| To avoid creating an open SPAM relay in default
| deployments, only allow "localhost" as server name.
@@ -87,11 +99,28 @@
+-->
<map:act type="req-params">
- <map:parameter name="parameters" value="use-action"/>
- <!--+
- | Use action to send mail
- +-->
+ <map:parameter name="parameters" value="use-flow"/>
+ <!--+
+ | Use flow to send mail
+ +-->
+ <map:call function="mail">
+ <map:parameter name="host" value="{request-param:smtphost}"/>
+ <map:parameter name="user" value="{request-param:smtpuser}"/>
+ <map:parameter name="password" value="{request-param:smtppassword}"/>
+ <map:parameter name="from" value="{request-param:from}"/>
+ <map:parameter name="to" value="{request-param:to}"/>
+ <map:parameter name="subject" value="{request-param:subject}"/>
+ <map:parameter name="body" value="{request-param:body}"/>
+ <map:parameter name="cc" value="{request-param:cc}"/>
+ <map:parameter name="bcc" value="{request-param:bcc}"/>
+ </map:call>
+ </map:act>
+ <map:act type="req-params">
+ <map:parameter name="parameters" value="use-action"/>
+ <!--+
+ | Use action to send mail
+ +-->
<map:act type="sendmail">
<!--+
| New sendmail action extends the deprecated action with options
@@ -120,10 +149,9 @@
<map:act type="req-params">
<map:parameter name="parameters" value="use-oldaction"/>
- <!--+
- | Use (deprecated) action to send mail
- +-->
-
+ <!--+
+ | Use (deprecated) action to send mail
+ +-->
<map:act type="old-sendmail">
<map:parameter name="smtp-host" value="{request-param:mail.smtphost}"/>
<map:parameter name="smtp-user" value="{request-param:smtpuser}"/>
@@ -149,15 +177,17 @@
<map:act type="req-params">
<map:parameter name="parameters" value="use-logicsheet"/>
- <!--+
- | Use logicsheet from XSP to send mail
- +-->
+ <!--+
+ | Use logicsheet from XSP to send mail
+ +-->
<map:call resource="show-page">
<map:parameter name="target" value="sendmail_xsp.xml"/>
<map:parameter name="remove" value="{0}"/>
</map:call>
</map:act>
+
</map:match> <!-- type="host-matcher" pattern="localhost" -->
+
<!-- default page -->
<map:call resource="show-page">