Author: lhein
Date: Mon Mar 31 03:33:11 2008
New Revision: 642956
URL: http://svn.apache.org/viewvc?rev=642956&view=rev
Log:
- fixed SM-1298 with a workaround
- added static receiver attribute to the sender endpoint config
- added the attribute also to the archetype
Modified:
servicemix/smx3/trunk/archetypes/servicemix-mail-service-unit/src/main/resources/archetype-resources/src/main/resources/xbean.xml
servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/MailSenderEndpoint.java
servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/marshaler/AbstractMailMarshaler.java
servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/marshaler/DefaultMailMarshaler.java
servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/test/java/org/apache/servicemix/mail/DefaultMailMarshalerTest.java
Modified:
servicemix/smx3/trunk/archetypes/servicemix-mail-service-unit/src/main/resources/archetype-resources/src/main/resources/xbean.xml
URL:
http://svn.apache.org/viewvc/servicemix/smx3/trunk/archetypes/servicemix-mail-service-unit/src/main/resources/archetype-resources/src/main/resources/xbean.xml?rev=642956&r1=642955&r2=642956&view=diff
==============================================================================
---
servicemix/smx3/trunk/archetypes/servicemix-mail-service-unit/src/main/resources/archetype-resources/src/main/resources/xbean.xml
(original)
+++
servicemix/smx3/trunk/archetypes/servicemix-mail-service-unit/src/main/resources/archetype-resources/src/main/resources/xbean.xml
Mon Mar 31 03:33:11 2008
@@ -33,6 +33,7 @@
<mail:sender service="replaceMe:mailService"
endpoint="senderEndpoint"
sender="[EMAIL PROTECTED]"
+ receiver="[EMAIL PROTECTED]"
debugMode="false"
connection="smtp://[EMAIL PROTECTED]" />
</beans>
Modified:
servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/MailSenderEndpoint.java
URL:
http://svn.apache.org/viewvc/servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/MailSenderEndpoint.java?rev=642956&r1=642955&r2=642956&view=diff
==============================================================================
---
servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/MailSenderEndpoint.java
(original)
+++
servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/MailSenderEndpoint.java
Mon Mar 31 03:33:11 2008
@@ -30,11 +30,8 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-
import org.apache.servicemix.common.endpoints.ProviderEndpoint;
-
import org.apache.servicemix.jbi.jaxp.StringSource;
-
import org.apache.servicemix.mail.marshaler.AbstractMailMarshaler;
import org.apache.servicemix.mail.marshaler.DefaultMailMarshaler;
import org.apache.servicemix.mail.utils.MailConnectionConfiguration;
@@ -54,6 +51,7 @@
private String customTrustManagers;
private String connection;
private String sender;
+ private String receiver;
private boolean debugMode;
/*
@@ -107,13 +105,16 @@
MimeMessage msg = new MimeMessage(session);
// let the marshaler to the conversion of message to mail
- this.marshaler.convertJBIToMail(msg, exchange, in,
this.sender);
+ this.marshaler.convertJBIToMail(msg, exchange, in,
this.sender, this.receiver);
// Send message
Transport.send(msg);
} catch (MessagingException mex) {
logger.error("Error sending mail...", mex);
throw mex;
+ } finally {
+ // delete all temporary allocated resources
+ this.marshaler.cleanUpResources();
}
}
}
@@ -153,7 +154,7 @@
MimeMessage msg = new MimeMessage(session);
// let the marshaler to the conversion of message to mail
- this.marshaler.convertJBIToMail(msg, exchange, in,
this.sender);
+ this.marshaler.convertJBIToMail(msg, exchange, in,
this.sender, this.receiver);
// Send message
Transport.send(msg);
@@ -163,6 +164,9 @@
} catch (MessagingException mex) {
logger.error("Error sending mail...", mex);
throw mex;
+ } finally {
+ // delete all temporary allocated resources
+ this.marshaler.cleanUpResources();
}
}
}
@@ -244,5 +248,19 @@
*/
public void setCustomTrustManagers(String customTrustManagers) {
this.customTrustManagers = customTrustManagers;
+ }
+
+ /**
+ * @return Returns the receiver.
+ */
+ public String getReceiver() {
+ return this.receiver;
+ }
+
+ /**
+ * @param receiver The receiver to set.
+ */
+ public void setReceiver(String receiver) {
+ this.receiver = receiver;
}
}
Modified:
servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/marshaler/AbstractMailMarshaler.java
URL:
http://svn.apache.org/viewvc/servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/marshaler/AbstractMailMarshaler.java?rev=642956&r1=642955&r2=642956&view=diff
==============================================================================
---
servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/marshaler/AbstractMailMarshaler.java
(original)
+++
servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/marshaler/AbstractMailMarshaler.java
Mon Mar 31 03:33:11 2008
@@ -16,8 +16,11 @@
*/
package org.apache.servicemix.mail.marshaler;
+import java.io.File;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -153,6 +156,18 @@
public static final String DEFAULT_SENDER = "[EMAIL PROTECTED]";
/**
+ * the dummy subject - set if no subject was provided
+ */
+ public static final String DUMMY_SUBJECT = "no subject";
+
+ /**
+ * the dummy content - set if no content was provided
+ */
+ public static final String DUMMY_CONTENT = "no content";
+
+ private List<File> temporaryFiles = new ArrayList<File>();
+
+ /**
* This method is used to convert a mime mail message received via an
* email server into a normalized message which will be sent to the bus.
* If you want to specify your own conversion behaviour you have to
override
@@ -172,14 +187,16 @@
* If you want to specify your own conversion behaviour you have to
override
* this method with your own logic.
*
- * @param mimeMessage the mime mail message to be filled by this
method
- * @param exchange the message exchange from JBI bus
- * @param nmsg the normalized message to transform to mail
message
- * @param configuredSender the sender configured in the xbean
+ * @param mimeMessage the mime mail message to be filled by
this method
+ * @param exchange the message exchange from JBI bus
+ * @param nmsg the normalized message to transform to
mail message
+ * @param configuredSender the sender configured in the xbean
+ * @param configuredReceiver the receiver configured in the xbean
* @throws javax.mail.MessagingException on conversion errors
*/
public abstract void convertJBIToMail(MimeMessage mimeMessage,
MessageExchange exchange,
- NormalizedMessage nmsg, String
configuredSender) throws javax.mail.MessagingException;
+ NormalizedMessage nmsg, String
configuredSender,
+ String configuredReceiver) throws
javax.mail.MessagingException;
/**
* returns the default sender for outgoing mails
@@ -214,5 +231,24 @@
}
return attachments;
+ }
+
+ /**
+ * adds a temporary file resource to the list
+ *
+ * @param tmpFile the temporary file to delete after sending mail
+ */
+ protected final void addTemporaryResource(File tmpFile) {
+ this.temporaryFiles.add(tmpFile);
+ }
+
+ /**
+ * deletes all temporary resources
+ */
+ public final void cleanUpResources() {
+ for (File f : this.temporaryFiles) {
+ f.delete();
+ }
+ this.temporaryFiles.clear();
}
}
Modified:
servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/marshaler/DefaultMailMarshaler.java
URL:
http://svn.apache.org/viewvc/servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/marshaler/DefaultMailMarshaler.java?rev=642956&r1=642955&r2=642956&view=diff
==============================================================================
---
servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/marshaler/DefaultMailMarshaler.java
(original)
+++
servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/main/java/org/apache/servicemix/mail/marshaler/DefaultMailMarshaler.java
Mon Mar 31 03:33:11 2008
@@ -16,16 +16,17 @@
*/
package org.apache.servicemix.mail.marshaler;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.text.DateFormat;
import java.util.Enumeration;
import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
import javax.activation.DataHandler;
-import javax.activation.DataSource;
+import javax.activation.FileDataSource;
import javax.jbi.messaging.MessageExchange;
import javax.jbi.messaging.MessagingException;
import javax.jbi.messaging.NormalizedMessage;
@@ -45,6 +46,7 @@
import org.apache.servicemix.jbi.jaxp.SourceTransformer;
import org.apache.servicemix.jbi.jaxp.StringSource;
import org.apache.servicemix.jbi.util.ByteArrayDataSource;
+import org.apache.servicemix.jbi.util.FileUtil;
/**
* this is the default marshaler for conversion between the normalized message
@@ -73,16 +75,17 @@
/*
* (non-Javadoc)
- *
- * @see
net.compart.jbi.mail.AMailMarshallerSupport#convertJBIToMail(javax.mail.internet.MimeMessage,
- * javax.jbi.messaging.MessageExchange,
javax.jbi.messaging.NormalizedMessage, String)
+ * @see org.apache.servicemix.mail.marshaler.AbstractMailMarshaler#
+ * convertJBIToMail(javax.mail.internet.MimeMessage,
javax.jbi.messaging.MessageExchange,
+ * javax.jbi.messaging.NormalizedMessage, java.lang.String,
java.lang.String)
*/
@Override
- public void convertJBIToMail(MimeMessage mimeMessage, MessageExchange
exchange, NormalizedMessage nmsg, String configuredSender)
+ public void convertJBIToMail(MimeMessage mimeMessage, MessageExchange
exchange,
+ NormalizedMessage nmsg, String
configuredSender, String configuredReceiver)
throws javax.mail.MessagingException {
try {
// first fill the headers of the mail
- fillMailHeaders(mimeMessage, exchange, nmsg, configuredSender);
+ fillMailHeaders(mimeMessage, exchange, nmsg, configuredSender,
configuredReceiver);
// fill the body and attachments
fillMailBodyAndAttachments(mimeMessage, exchange, nmsg);
@@ -101,14 +104,10 @@
*/
protected void fillMailBodyAndAttachments(MimeMessage mimeMessage,
MessageExchange exchange,
NormalizedMessage nmsg) throws
Exception {
- // extract all attachments from the normalized message into a map
- Map<String, DataSource> attachments =
getAttachmentsMapFromNormalizedMessage(nmsg);
-
// if there are attachments, then a multipart mime mail with
// attachments will be sent
- if (attachments.size() > 0) {
- Set<String> attNames = attachments.keySet();
- Iterator<String> itAttNames = attNames.iterator();
+ if (nmsg.getAttachmentNames().size() > 0) {
+ Iterator itAttNames = nmsg.getAttachmentNames().iterator();
if (itAttNames.hasNext()) {
// there is at least one attachment
@@ -123,13 +122,34 @@
// loop the existing attachments and put them to the mail
while (itAttNames.hasNext()) {
- String oneAttachmentName = itAttNames.next();
+ String oneAttachmentName = (String)itAttNames.next();
+
+ // For some strange reason the java mail tries to
+ // read the input stream of the attachments twice.
+ // this is impossible if the used data source is of
+ // type StreamDataSource (used for example in the
+ // binary file marshaler)
+ // ----------------------------------------------------
+ // As a not so nice workaround we do store the contents
+ // of the stream as a temporary file and then attach
+ // this file as FileDataSource to the mails attachment.
+ // This may cause some slight performance loss.
+ DataHandler dh = nmsg.getAttachment(oneAttachmentName);
+ File f = File.createTempFile("" +
System.currentTimeMillis() + "-", dh.getDataSource().getName());
+ BufferedOutputStream bos = new BufferedOutputStream(new
FileOutputStream(f));
+ FileUtil.copyInputStream(dh.getInputStream(), bos);
+ bos.close();
+
+ log.debug("Saved temp file: " + f.getName() + " with
length: " + f.length());
+
+ // add the file to the temporary resources list
+ addTemporaryResource(f);
// Create another body part
messageBodyPart = new MimeBodyPart();
// Set the data handler to the attachment
- messageBodyPart.setDataHandler(new
DataHandler(attachments.get(oneAttachmentName)));
+ messageBodyPart.setDataHandler(new DataHandler(new
FileDataSource(f)));
// Set the filename
- messageBodyPart.setFileName(oneAttachmentName);
+ messageBodyPart.setFileName(dh.getDataSource().getName());
// Set Disposition
messageBodyPart.setDisposition(Part.ATTACHMENT);
// Add part to multipart
@@ -160,7 +180,7 @@
boolean isHtmlMessage =
nmsg.getProperty(AbstractMailMarshaler.MSG_TAG_HTML) != null;
if (isPlainTextMessage && !isHtmlMessage) {
- // a plain text mail will be sent - no attachments
+ // a plain text mail will be sent
if (content != null) {
content.setSubType("mixed");
MimeBodyPart textBodyPart = new MimeBodyPart();
@@ -171,7 +191,7 @@
mimeMessage.setText(nmsg.getProperty(AbstractMailMarshaler.MSG_TAG_TEXT).toString());
}
} else if (isHtmlMessage && !isPlainTextMessage) {
- // a html message will be sent - no attachments
+ // a html message will be sent
if (content != null) {
content.setSubType("mixed");
MimeBodyPart htmlBodyPart = new MimeBodyPart();
@@ -188,7 +208,7 @@
mimeMessage.setContent(content);
}
} else if (isHtmlMessage && isPlainTextMessage) {
- // both parts will be sent - plain text and html
+ // both parts will be sent
if (content != null) {
content.setSubType("mixed");
MimeBodyPart textBodyPart = new MimeBodyPart();
@@ -213,35 +233,47 @@
mimeMessage.setContent(content);
}
} else {
- // use the content of the message
- SourceTransformer st = new SourceTransformer();
- try {
- st.toDOMDocument(nmsg);
-
- // a html message will be sent
- if (content != null) {
- content.setSubType("mixed");
- MimeBodyPart htmlBodyPart = new MimeBodyPart();
- htmlBodyPart.setContent(st.contentToString(nmsg),
"text/html");
- content.addBodyPart(htmlBodyPart);
- } else {
- content = new MimeMultipart("mixed");
- MimeBodyPart htmlBodyPart = new MimeBodyPart();
- htmlBodyPart.setContent(st.contentToString(nmsg),
"text/html");
- content.addBodyPart(htmlBodyPart);
- // Put parts in message
- mimeMessage.setContent(content);
+ if (nmsg.getContent() != null) {
+ // use the content of the message
+ SourceTransformer st = new SourceTransformer();
+ try {
+ st.toDOMDocument(nmsg);
+
+ // a html message will be sent
+ if (content != null) {
+ content.setSubType("mixed");
+ MimeBodyPart htmlBodyPart = new MimeBodyPart();
+ htmlBodyPart.setContent(st.contentToString(nmsg),
"text/html");
+ content.addBodyPart(htmlBodyPart);
+ } else {
+ content = new MimeMultipart("mixed");
+ MimeBodyPart htmlBodyPart = new MimeBodyPart();
+ htmlBodyPart.setContent(st.contentToString(nmsg),
"text/html");
+ content.addBodyPart(htmlBodyPart);
+ // Put parts in message
+ mimeMessage.setContent(content);
+ }
+ } catch (Exception ex) {
+ // no xml document - plain text used now
+ if (content != null) {
+ content.setSubType("mixed");
+ MimeBodyPart textBodyPart = new MimeBodyPart();
+ textBodyPart.setContent(st.contentToString(nmsg),
"text/plain");
+ content.addBodyPart(textBodyPart);
+ } else {
+ // Put text in message
+ mimeMessage.setText(st.contentToString(nmsg));
+ }
}
- } catch (Exception ex) {
- // no xml document - plain text used now
+ } else {
+ // a plain text mail will be sent
if (content != null) {
content.setSubType("mixed");
MimeBodyPart textBodyPart = new MimeBodyPart();
- textBodyPart.setContent(st.contentToString(nmsg),
"text/plain");
+
textBodyPart.setContent(AbstractMailMarshaler.DUMMY_CONTENT, "text/plain");
content.addBodyPart(textBodyPart);
} else {
- // Put text in message
- mimeMessage.setText(st.contentToString(nmsg));
+ mimeMessage.setText(AbstractMailMarshaler.DUMMY_CONTENT);
}
}
}
@@ -254,16 +286,27 @@
* @param exchange the exchange received
* @param nmsg the normalized message received
* @param configuredSender the configured sender from xbean
+ * @param configuredReceiver the configured receiver from xbean
* @throws Exception on errors
*/
- protected void fillMailHeaders(MimeMessage mimeMessage, MessageExchange
exchange, NormalizedMessage nmsg, String configuredSender)
+ protected void fillMailHeaders(MimeMessage mimeMessage, MessageExchange
exchange,
+ NormalizedMessage nmsg, String
configuredSender, String configuredReceiver)
throws Exception {
// fill the "To" field of the mail
+ // if there is a TO property, this overrides the standard receiver
if (nmsg.getProperty(AbstractMailMarshaler.MSG_TAG_TO) != null) {
Address[] to =
InternetAddress.parse(nmsg.getProperty(AbstractMailMarshaler.MSG_TAG_TO)
.toString());
if (to != null) {
mimeMessage.setRecipients(Message.RecipientType.TO, to);
+ }
+ // there is no TO property, so try the configured receiver
+ } else {
+ if (configuredReceiver != null) {
+ Address[] to = InternetAddress.parse(configuredReceiver);
+ if (to != null) {
+ mimeMessage.setRecipients(Message.RecipientType.TO, to);
+ }
}
}
@@ -312,8 +355,12 @@
String subject =
nmsg.getProperty(AbstractMailMarshaler.MSG_TAG_SUBJECT).toString();
if (subject != null) {
mimeMessage.setSubject(subject);
+ } else {
+ mimeMessage.setSubject(AbstractMailMarshaler.DUMMY_SUBJECT);
}
- }
+ } else {
+ mimeMessage.setSubject(AbstractMailMarshaler.DUMMY_SUBJECT);
+ }
// fill the "Date" field of the mail
if (nmsg.getProperty(AbstractMailMarshaler.MSG_TAG_SENTDATE) != null) {
Modified:
servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/test/java/org/apache/servicemix/mail/DefaultMailMarshalerTest.java
URL:
http://svn.apache.org/viewvc/servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/test/java/org/apache/servicemix/mail/DefaultMailMarshalerTest.java?rev=642956&r1=642955&r2=642956&view=diff
==============================================================================
---
servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/test/java/org/apache/servicemix/mail/DefaultMailMarshalerTest.java
(original)
+++
servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-mail/src/test/java/org/apache/servicemix/mail/DefaultMailMarshalerTest.java
Mon Mar 31 03:33:11 2008
@@ -302,7 +302,7 @@
nmsg.setContent(new StringSource(TEXT));
// convert
- marshaler.convertJBIToMail(mail, exchange, nmsg, null);
+ marshaler.convertJBIToMail(mail, exchange, nmsg, null, null);
// test the result
assertEquals("The FROM is invalid!", FROM,
mail.getHeader(AbstractMailMarshaler.MAIL_TAG_FROM)[0]
@@ -340,7 +340,7 @@
nmsg.setContent(new StringSource(HTML));
// convert
- marshaler.convertJBIToMail(mail, exchange, nmsg, null);
+ marshaler.convertJBIToMail(mail, exchange, nmsg, null, null);
// test the result
assertEquals("The FROM is invalid!", FROM,
mail.getHeader(AbstractMailMarshaler.MAIL_TAG_FROM)[0]
@@ -380,7 +380,7 @@
nmsg.setContent(new StringSource(TEXT));
// convert
- marshaler.convertJBIToMail(mail, exchange, nmsg, null);
+ marshaler.convertJBIToMail(mail, exchange, nmsg, null, null);
// test the result
assertEquals("The FROM is invalid!", FROM,
mail.getHeader(AbstractMailMarshaler.MAIL_TAG_FROM)[0]
@@ -421,7 +421,7 @@
nmsg.setContent(new StringSource(TEXT));
// convert
- marshaler.convertJBIToMail(mail, exchange, nmsg, null);
+ marshaler.convertJBIToMail(mail, exchange, nmsg, null, null);
// test the result
assertEquals("The FROM is invalid!", FROM,
mail.getHeader(AbstractMailMarshaler.MAIL_TAG_FROM)[0]
@@ -459,7 +459,7 @@
nmsg.setContent(new StringSource(HTML));
// convert
- marshaler.convertJBIToMail(mail, exchange, nmsg, null);
+ marshaler.convertJBIToMail(mail, exchange, nmsg, null, null);
// test the result
assertEquals("The FROM is invalid!", FROM,
mail.getHeader(AbstractMailMarshaler.MAIL_TAG_FROM)[0]
@@ -500,7 +500,7 @@
nmsg.addAttachment(FILE, new DataHandler(new FileDataSource(new
File(PATH, FILE))));
// convert
- marshaler.convertJBIToMail(mail, exchange, nmsg, null);
+ marshaler.convertJBIToMail(mail, exchange, nmsg, null, null);
// test the result
assertEquals("The FROM is invalid!", FROM,
mail.getHeader(AbstractMailMarshaler.MAIL_TAG_FROM)[0]
@@ -551,7 +551,7 @@
nmsg.addAttachment(FILE, new DataHandler(new FileDataSource(new
File(PATH, FILE))));
// convert
- marshaler.convertJBIToMail(mail, exchange, nmsg, null);
+ marshaler.convertJBIToMail(mail, exchange, nmsg, null, null);
// test the result
assertEquals("The FROM is invalid!", FROM,
mail.getHeader(AbstractMailMarshaler.MAIL_TAG_FROM)[0]
@@ -603,7 +603,7 @@
nmsg.addAttachment(FILE, new DataHandler(new FileDataSource(new
File(PATH, FILE))));
// convert
- marshaler.convertJBIToMail(mail, exchange, nmsg, null);
+ marshaler.convertJBIToMail(mail, exchange, nmsg, null, null);
// test the result
assertEquals("The FROM is invalid!", FROM,
mail.getHeader(AbstractMailMarshaler.MAIL_TAG_FROM)[0]
@@ -656,7 +656,7 @@
nmsg.addAttachment(FILE, new DataHandler(new FileDataSource(new
File(PATH, FILE))));
// convert
- marshaler.convertJBIToMail(mail, exchange, nmsg, null);
+ marshaler.convertJBIToMail(mail, exchange, nmsg, null, null);
// test the result
assertEquals("The FROM is invalid!", FROM,
mail.getHeader(AbstractMailMarshaler.MAIL_TAG_FROM)[0]
@@ -707,7 +707,7 @@
nmsg.addAttachment(FILE, new DataHandler(new FileDataSource(new
File(PATH, FILE))));
// convert
- marshaler.convertJBIToMail(mail, exchange, nmsg, null);
+ marshaler.convertJBIToMail(mail, exchange, nmsg, null, null);
// test the result
assertEquals("The FROM is invalid!", FROM,
mail.getHeader(AbstractMailMarshaler.MAIL_TAG_FROM)[0]