javax.mail.internet
Class MimeMessage

java.lang.Object
  extended byjavax.mail.Message
      extended byjavax.mail.internet.MimeMessage
All Implemented Interfaces:
MimePart, Part

public class MimeMessage
extends Message
implements MimePart

Version:
$Rev: 219440 $ $Date: 2005-07-17 20:33:57 -0600 (Sun, 17 Jul 2005) $

Nested Class Summary
static class MimeMessage.RecipientType
          Extends Message.RecipientType to support addition recipient types.
 
Field Summary
protected  byte[] content
          This message's content (unless sourced from a SharedInputStream).
protected  java.io.InputStream contentStream
          If the data for this message was supplied by a SharedInputStream then this is another such stream representing the content of this message; if this field is non-null, then content will be null.
private  MailDateFormat dateFormat
           
protected  DataHandler dh
          The DataHandler for this Message's content.
protected  Flags flags
          This message's flags.
protected  InternetHeaders headers
          This message's headers.
protected  boolean modified
          Flag indicating that the message has been modified; set to true when an empty message is created or when saveChanges() is called.
protected  boolean saved
          Flag indicating that the message has been saved.
 
Fields inherited from class javax.mail.Message
expunged, folder, msgnum, session
 
Fields inherited from interface javax.mail.Part
ATTACHMENT, INLINE
 
Constructor Summary
protected MimeMessage(Folder folder, java.io.InputStream in, int number)
          Create a MimeMessage by reading an parsing the data from the supplied stream.
protected MimeMessage(Folder folder, int number)
          Create an new MimeMessage in the supplied Folder and message number.
protected MimeMessage(Folder folder, InternetHeaders headers, byte[] content, int number)
          Create a MimeMessage with the supplied headers and content.
  MimeMessage(MimeMessage message)
          Copy a MimeMessage.
  MimeMessage(Session session)
          Create a new MimeMessage.
  MimeMessage(Session session, java.io.InputStream in)
          Create a MimeMessage by reading an parsing the data from the supplied stream.
 
Method Summary
 void addFrom(Address[] addresses)
          Add multiple addresses to the "From" header.
private  void addHeader(java.lang.String header, Address[] addresses)
           
 void addHeader(java.lang.String name, java.lang.String value)
           
 void addHeaderLine(java.lang.String line)
           
 void addRecipients(Message.RecipientType type, Address[] address)
          Add recipents of a specified type.
 void addRecipients(Message.RecipientType type, java.lang.String address)
           
private  void addRecipientsToList(java.util.List list, Message.RecipientType type)
           
protected  InternetHeaders createInternetHeaders(java.io.InputStream in)
           
 java.util.Enumeration getAllHeaderLines()
           
 java.util.Enumeration getAllHeaders()
           
 Address[] getAllRecipients()
          Get all recipients of this message.
 java.lang.Object getContent()
           
 java.lang.String getContentID()
           
 java.lang.String[] getContentLanguage()
           
 java.lang.String getContentMD5()
           
protected  java.io.InputStream getContentStream()
           
 java.lang.String getContentType()
           
 DataHandler getDataHandler()
           
 java.lang.String getDescription()
           
 java.lang.String getDisposition()
           
 java.lang.String getEncoding()
           
 java.lang.String getFileName()
           
 Flags getFlags()
          Return a copy the flags associated with this message.
 Address[] getFrom()
          Return the "From" header indicating the identity of the person who the message is from; in some circumstances this may be different to the actual sender.
 java.lang.String[] getHeader(java.lang.String name)
           
 java.lang.String getHeader(java.lang.String name, java.lang.String delimiter)
           
private  InternetAddress[] getHeaderAsAddresses(java.lang.String header, boolean strict)
           
private  java.lang.String getHeaderForRecipientType(Message.RecipientType type)
           
 java.io.InputStream getInputStream()
           
 int getLineCount()
           
 java.util.Enumeration getMatchingHeaderLines(java.lang.String[] names)
           
 java.util.Enumeration getMatchingHeaders(java.lang.String[] names)
           
 java.lang.String getMessageID()
           
 java.util.Enumeration getNonMatchingHeaderLines(java.lang.String[] names)
           
 java.util.Enumeration getNonMatchingHeaders(java.lang.String[] names)
           
 java.io.InputStream getRawInputStream()
           
 java.util.Date getReceivedDate()
          Return the date this message was received.
 Address[] getRecipients(Message.RecipientType type)
          Get all recipients of the given type.
 Address[] getReplyTo()
          Get the addresses to which replies should be directed.
 Address getSender()
          Return the "Sender" header as an address.
 java.util.Date getSentDate()
          Return the date that this message was sent.
private  java.lang.String getSingleHeader(java.lang.String name)
           
 int getSize()
           
 java.lang.String getSubject()
          Get the subject for this message.
 boolean isMimeType(java.lang.String type)
           
 boolean isSet(Flags.Flag flag)
          Check whether the supplied flag is set.
private  boolean isStrictAddressing()
           
protected  void parse(java.io.InputStream in)
          Parse the supplied stream and initialize headers and content appropriately.
 void removeHeader(java.lang.String name)
           
 Message reply(boolean replyToAll)
          Create a new message suitable as a reply to this message with all headers set up appropriately.
 void saveChanges()
          To ensure changes are saved to the store, this message should be invoked before its containing folder is closed.
 void setContent(Multipart part)
           
 void setContent(java.lang.Object content, java.lang.String type)
           
 void setContentID(java.lang.String cid)
           
 void setContentLanguage(java.lang.String[] languages)
           
 void setContentMD5(java.lang.String md5)
           
 void setDataHandler(DataHandler handler)
           
 void setDescription(java.lang.String description)
           
 void setDescription(java.lang.String description, java.lang.String charset)
           
 void setDisposition(java.lang.String disposition)
           
 void setFileName(java.lang.String name)
           
 void setFlags(Flags flags, boolean set)
          Set the flags specified to the supplied value; flags not included in the supplied Flags parameter are not affected.
 void setFrom()
          Set the "From" header using the value returned by InternetAddress.getLocalAddress(javax.mail.Session).
 void setFrom(Address address)
          Set the "From" header to the supplied address.
private  void setHeader(java.lang.String header, Address address)
           
private  void setHeader(java.lang.String header, Address[] addresses)
           
 void setHeader(java.lang.String name, java.lang.String value)
           
 void setRecipients(Message.RecipientType type, Address[] addresses)
          Set the list of recipients for the specified type.
 void setRecipients(Message.RecipientType type, java.lang.String address)
           
 void setReplyTo(Address[] address)
          Set the addresses to which replies should be directed.
 void setSender(Address address)
          Set the "Sender" header.
 void setSentDate(java.util.Date sent)
          Set the date this message was sent.
 void setSubject(java.lang.String subject)
          Set the subject of this message
 void setSubject(java.lang.String subject, java.lang.String charset)
           
 void setText(java.lang.String text)
           
 void setText(java.lang.String text, java.lang.String charset)
           
protected  void updateHeaders()
           
 void writeTo(java.io.OutputStream out)
           
 void writeTo(java.io.OutputStream out, java.lang.String[] ignoreHeaders)
           
 
Methods inherited from class javax.mail.Message
addRecipient, getFolder, getMessageNumber, isExpunged, match, setExpunged, setFlag, setMessageNumber, setRecipient
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dh

protected DataHandler dh
The DataHandler for this Message's content.


content

protected byte[] content
This message's content (unless sourced from a SharedInputStream).


contentStream

protected java.io.InputStream contentStream
If the data for this message was supplied by a SharedInputStream then this is another such stream representing the content of this message; if this field is non-null, then content will be null.


headers

protected InternetHeaders headers
This message's headers.


flags

protected Flags flags
This message's flags.


modified

protected boolean modified
Flag indicating that the message has been modified; set to true when an empty message is created or when saveChanges() is called.


saved

protected boolean saved
Flag indicating that the message has been saved.


dateFormat

private final MailDateFormat dateFormat
Constructor Detail

MimeMessage

public MimeMessage(Session session)
Create a new MimeMessage. An empty message is created, with empty headers and empty flags. The modified flag is set.

Parameters:
session - the session for this message

MimeMessage

public MimeMessage(Session session,
                   java.io.InputStream in)
            throws MessagingException
Create a MimeMessage by reading an parsing the data from the supplied stream.

Parameters:
session - the session for this message
in - the stream to load from
Throws:
MessagingException - if there is a problem reading or parsing the stream

MimeMessage

public MimeMessage(MimeMessage message)
            throws MessagingException
Copy a MimeMessage.

Parameters:
message - the message to copy
Throws:
MessagingException - is there was a problem copying the message

MimeMessage

protected MimeMessage(Folder folder,
                      int number)
Create an new MimeMessage in the supplied Folder and message number.

Parameters:
folder - the Folder that contains the new message
number - the message number of the new message

MimeMessage

protected MimeMessage(Folder folder,
                      java.io.InputStream in,
                      int number)
               throws MessagingException
Create a MimeMessage by reading an parsing the data from the supplied stream.

Parameters:
folder - the folder for this message
in - the stream to load from
number - the message number of the new message
Throws:
MessagingException - if there is a problem reading or parsing the stream

MimeMessage

protected MimeMessage(Folder folder,
                      InternetHeaders headers,
                      byte[] content,
                      int number)
               throws MessagingException
Create a MimeMessage with the supplied headers and content.

Parameters:
folder - the folder for this message
headers - the headers for the new message
content - the content of the new message
number - the message number of the new message
Throws:
MessagingException - if there is a problem reading or parsing the stream
Method Detail

parse

protected void parse(java.io.InputStream in)
              throws MessagingException
Parse the supplied stream and initialize headers and content appropriately.

Parameters:
in - the stream to read
Throws:
MessagingException - if there was a problem parsing the stream

getFrom

public Address[] getFrom()
                  throws MessagingException
Description copied from class: Message
Return the "From" header indicating the identity of the person who the message is from; in some circumstances this may be different to the actual sender.

Specified by:
getFrom in class Message
Returns:
a list of addresses this message is from; may be empty if the header is present but empty, or null if the header is not present
Throws:
MessagingException - if there was a problem accessing the store

setFrom

public void setFrom(Address address)
             throws MessagingException
Description copied from class: Message
Set the "From" header to the supplied address.

Specified by:
setFrom in class Message
Parameters:
address - the address of the person who the message is from
Throws:
MessagingException - if there was a problem accessing the store

setFrom

public void setFrom()
             throws MessagingException
Set the "From" header using the value returned by InternetAddress.getLocalAddress(javax.mail.Session).

Specified by:
setFrom in class Message
Throws:
MessagingException - if there was a problem setting the header

addFrom

public void addFrom(Address[] addresses)
             throws MessagingException
Description copied from class: Message
Add multiple addresses to the "From" header.

Specified by:
addFrom in class Message
Parameters:
addresses - the addresses to add
Throws:
MessagingException - if there was a problem accessing the store

getSender

public Address getSender()
                  throws MessagingException
Return the "Sender" header as an address.

Returns:
the "Sender" header as an address, or null if not present
Throws:
MessagingException - if there was a problem parsing the header

setSender

public void setSender(Address address)
               throws MessagingException
Set the "Sender" header.

Parameters:
address - the new Sender address
Throws:
MessagingException - if there was a problem setting the header

getRecipients

public Address[] getRecipients(Message.RecipientType type)
                        throws MessagingException
Description copied from class: Message
Get all recipients of the given type.

Specified by:
getRecipients in class Message
Parameters:
type - the type of recipient to get
Returns:
a list of addresses; may be empty if the header is present but empty, or null if the header is not present
Throws:
MessagingException - if there was a problem accessing the store
See Also:
Message.RecipientType

getAllRecipients

public Address[] getAllRecipients()
                           throws MessagingException
Description copied from class: Message
Get all recipients of this message. The default implementation extracts the To, Cc, and Bcc recipients using Message.getRecipients(javax.mail.Message.RecipientType) and then concatentates the results into a single array; it returns null if no headers are defined.

Overrides:
getAllRecipients in class Message
Returns:
an array containing all recipients
Throws:
MessagingException - if there was a problem accessing the store

addRecipientsToList

private void addRecipientsToList(java.util.List list,
                                 Message.RecipientType type)
                          throws MessagingException
Throws:
MessagingException

setRecipients

public void setRecipients(Message.RecipientType type,
                          Address[] addresses)
                   throws MessagingException
Description copied from class: Message
Set the list of recipients for the specified type.

Specified by:
setRecipients in class Message
Parameters:
type - the type of recipient
addresses - the new addresses
Throws:
MessagingException - if there was a problem accessing the store

setRecipients

public void setRecipients(Message.RecipientType type,
                          java.lang.String address)
                   throws MessagingException
Throws:
MessagingException

addRecipients

public void addRecipients(Message.RecipientType type,
                          Address[] address)
                   throws MessagingException
Description copied from class: Message
Add recipents of a specified type.

Specified by:
addRecipients in class Message
Parameters:
type - the type of recipient
address - the addresses to add
Throws:
MessagingException - if there was a problem accessing the store

addRecipients

public void addRecipients(Message.RecipientType type,
                          java.lang.String address)
                   throws MessagingException
Throws:
MessagingException

getReplyTo

public Address[] getReplyTo()
                     throws MessagingException
Description copied from class: Message
Get the addresses to which replies should be directed.

As the most common behavior is to return to sender, the default implementation simply calls Message.getFrom().

Overrides:
getReplyTo in class Message
Returns:
a list of addresses to which replies should be directed
Throws:
MessagingException - if there was a problem accessing the store

setReplyTo

public void setReplyTo(Address[] address)
                throws MessagingException
Description copied from class: Message
Set the addresses to which replies should be directed.

The default implementation throws a MethodNotSupportedException.

Overrides:
setReplyTo in class Message
Parameters:
address - to which replies should be directed
Throws:
MessagingException - if there was a problem accessing the store

getSubject

public java.lang.String getSubject()
                            throws MessagingException
Description copied from class: Message
Get the subject for this message.

Specified by:
getSubject in class Message
Returns:
the subject
Throws:
MessagingException - if there was a problem accessing the store

setSubject

public void setSubject(java.lang.String subject)
                throws MessagingException
Description copied from class: Message
Set the subject of this message

Specified by:
setSubject in class Message
Parameters:
subject - the subject
Throws:
MessagingException - if there was a problem accessing the store

setSubject

public void setSubject(java.lang.String subject,
                       java.lang.String charset)
                throws MessagingException
Throws:
MessagingException

getSentDate

public java.util.Date getSentDate()
                           throws MessagingException
Description copied from class: Message
Return the date that this message was sent.

Specified by:
getSentDate in class Message
Returns:
the date this message was sent
Throws:
MessagingException - if there was a problem accessing the store

setSentDate

public void setSentDate(java.util.Date sent)
                 throws MessagingException
Description copied from class: Message
Set the date this message was sent.

Specified by:
setSentDate in class Message
Parameters:
sent - the date when this message was sent
Throws:
MessagingException - if there was a problem accessing the store

getReceivedDate

public java.util.Date getReceivedDate()
                               throws MessagingException
Description copied from class: Message
Return the date this message was received.

Specified by:
getReceivedDate in class Message
Returns:
the date this message was received
Throws:
MessagingException - if there was a problem accessing the store

getSize

public int getSize()
            throws MessagingException
Specified by:
getSize in interface Part
Throws:
MessagingException

getLineCount

public int getLineCount()
                 throws MessagingException
Specified by:
getLineCount in interface Part
Throws:
MessagingException

getContentType

public java.lang.String getContentType()
                                throws MessagingException
Specified by:
getContentType in interface Part
Throws:
MessagingException

isMimeType

public boolean isMimeType(java.lang.String type)
                   throws MessagingException
Specified by:
isMimeType in interface Part
Throws:
MessagingException

getDisposition

public java.lang.String getDisposition()
                                throws MessagingException
Specified by:
getDisposition in interface Part
Throws:
MessagingException

setDisposition

public void setDisposition(java.lang.String disposition)
                    throws MessagingException
Specified by:
setDisposition in interface Part
Throws:
MessagingException

getEncoding

public java.lang.String getEncoding()
                             throws MessagingException
Specified by:
getEncoding in interface MimePart
Throws:
MessagingException

getContentID

public java.lang.String getContentID()
                              throws MessagingException
Specified by:
getContentID in interface MimePart
Throws:
MessagingException

setContentID

public void setContentID(java.lang.String cid)
                  throws MessagingException
Throws:
MessagingException

getContentMD5

public java.lang.String getContentMD5()
                               throws MessagingException
Specified by:
getContentMD5 in interface MimePart
Throws:
MessagingException

setContentMD5

public void setContentMD5(java.lang.String md5)
                   throws MessagingException
Specified by:
setContentMD5 in interface MimePart
Throws:
MessagingException

getDescription

public java.lang.String getDescription()
                                throws MessagingException
Specified by:
getDescription in interface Part
Throws:
MessagingException

setDescription

public void setDescription(java.lang.String description)
                    throws MessagingException
Specified by:
setDescription in interface Part
Throws:
MessagingException

setDescription

public void setDescription(java.lang.String description,
                           java.lang.String charset)
                    throws MessagingException
Throws:
MessagingException

getContentLanguage

public java.lang.String[] getContentLanguage()
                                      throws MessagingException
Specified by:
getContentLanguage in interface MimePart
Throws:
MessagingException

setContentLanguage

public void setContentLanguage(java.lang.String[] languages)
                        throws MessagingException
Specified by:
setContentLanguage in interface MimePart
Throws:
MessagingException

getMessageID

public java.lang.String getMessageID()
                              throws MessagingException
Throws:
MessagingException

getFileName

public java.lang.String getFileName()
                             throws MessagingException
Specified by:
getFileName in interface Part
Throws:
MessagingException

setFileName

public void setFileName(java.lang.String name)
                 throws MessagingException
Specified by:
setFileName in interface Part
Throws:
MessagingException

getInputStream

public java.io.InputStream getInputStream()
                                   throws MessagingException,
                                          java.io.IOException
Specified by:
getInputStream in interface Part
Throws:
MessagingException
java.io.IOException

getContentStream

protected java.io.InputStream getContentStream()
                                        throws MessagingException
Throws:
MessagingException

getRawInputStream

public java.io.InputStream getRawInputStream()
                                      throws MessagingException
Throws:
MessagingException

getDataHandler

public DataHandler getDataHandler()
                           throws MessagingException
Specified by:
getDataHandler in interface Part
Throws:
MessagingException

getContent

public java.lang.Object getContent()
                            throws MessagingException,
                                   java.io.IOException
Specified by:
getContent in interface Part
Throws:
MessagingException
java.io.IOException

setDataHandler

public void setDataHandler(DataHandler handler)
                    throws MessagingException
Specified by:
setDataHandler in interface Part
Throws:
MessagingException

setContent

public void setContent(java.lang.Object content,
                       java.lang.String type)
                throws MessagingException
Specified by:
setContent in interface Part
Throws:
MessagingException

setText

public void setText(java.lang.String text)
             throws MessagingException
Specified by:
setText in interface MimePart
Throws:
MessagingException

setText

public void setText(java.lang.String text,
                    java.lang.String charset)
             throws MessagingException
Specified by:
setText in interface MimePart
Throws:
MessagingException

setContent

public void setContent(Multipart part)
                throws MessagingException
Specified by:
setContent in interface Part
Throws:
MessagingException

reply

public Message reply(boolean replyToAll)
              throws MessagingException
Description copied from class: Message
Create a new message suitable as a reply to this message with all headers set up appropriately. The message body will be empty.

if replyToAll is set then the new message will be addressed to all recipients of this message; otherwise the reply will be addressed only to the sender as returned by Message.getReplyTo().

The subject field will be initialized with the subject field from the orginal message; the text "Re:" will be prepended unless it is already present.

Specified by:
reply in class Message
Parameters:
replyToAll - if true, indciates the message should be addressed to all recipients not just the sender
Returns:
a new message suitable as a reply to this message
Throws:
MessagingException - if there was a problem accessing the store

writeTo

public void writeTo(java.io.OutputStream out)
             throws MessagingException,
                    java.io.IOException
Specified by:
writeTo in interface Part
Throws:
MessagingException
java.io.IOException

writeTo

public void writeTo(java.io.OutputStream out,
                    java.lang.String[] ignoreHeaders)
             throws MessagingException,
                    java.io.IOException
Throws:
MessagingException
java.io.IOException

getHeader

public java.lang.String[] getHeader(java.lang.String name)
                             throws MessagingException
Specified by:
getHeader in interface Part
Throws:
MessagingException

getHeader

public java.lang.String getHeader(java.lang.String name,
                                  java.lang.String delimiter)
                           throws MessagingException
Specified by:
getHeader in interface MimePart
Throws:
MessagingException

setHeader

public void setHeader(java.lang.String name,
                      java.lang.String value)
               throws MessagingException
Specified by:
setHeader in interface Part
Throws:
MessagingException

addHeader

public void addHeader(java.lang.String name,
                      java.lang.String value)
               throws MessagingException
Specified by:
addHeader in interface Part
Throws:
MessagingException

removeHeader

public void removeHeader(java.lang.String name)
                  throws MessagingException
Specified by:
removeHeader in interface Part
Throws:
MessagingException

getAllHeaders

public java.util.Enumeration getAllHeaders()
                                    throws MessagingException
Specified by:
getAllHeaders in interface Part
Throws:
MessagingException

getMatchingHeaders

public java.util.Enumeration getMatchingHeaders(java.lang.String[] names)
                                         throws MessagingException
Specified by:
getMatchingHeaders in interface Part
Throws:
MessagingException

getNonMatchingHeaders

public java.util.Enumeration getNonMatchingHeaders(java.lang.String[] names)
                                            throws MessagingException
Specified by:
getNonMatchingHeaders in interface Part
Throws:
MessagingException

addHeaderLine

public void addHeaderLine(java.lang.String line)
                   throws MessagingException
Specified by:
addHeaderLine in interface MimePart
Throws:
MessagingException

getAllHeaderLines

public java.util.Enumeration getAllHeaderLines()
                                        throws MessagingException
Specified by:
getAllHeaderLines in interface MimePart
Throws:
MessagingException

getMatchingHeaderLines

public java.util.Enumeration getMatchingHeaderLines(java.lang.String[] names)
                                             throws MessagingException
Specified by:
getMatchingHeaderLines in interface MimePart
Throws:
MessagingException

getNonMatchingHeaderLines

public java.util.Enumeration getNonMatchingHeaderLines(java.lang.String[] names)
                                                throws MessagingException
Specified by:
getNonMatchingHeaderLines in interface MimePart
Throws:
MessagingException

getFlags

public Flags getFlags()
               throws MessagingException
Description copied from class: Message
Return a copy the flags associated with this message.

Specified by:
getFlags in class Message
Returns:
a copy of the flags for this message
Throws:
MessagingException - if there was a problem accessing the store

isSet

public boolean isSet(Flags.Flag flag)
              throws MessagingException
Description copied from class: Message
Check whether the supplied flag is set. The default implementation checks the flags returned by Message.getFlags().

Overrides:
isSet in class Message
Parameters:
flag - the flags to check for
Returns:
true if the flags is set
Throws:
MessagingException - if there was a problem accessing the store

setFlags

public void setFlags(Flags flags,
                     boolean set)
              throws MessagingException
Description copied from class: Message
Set the flags specified to the supplied value; flags not included in the supplied Flags parameter are not affected.

Specified by:
setFlags in class Message
Parameters:
flags - the flags to modify
set - the new value of those flags
Throws:
MessagingException - if there was a problem accessing the store

saveChanges

public void saveChanges()
                 throws MessagingException
Description copied from class: Message
To ensure changes are saved to the store, this message should be invoked before its containing folder is closed. Implementations may save modifications immediately but are free to defer such updates to they may be sent to the server in one batch; if saveChanges is not called then such changes may not be made permanent.

Specified by:
saveChanges in class Message
Throws:
MessagingException - if there was a problem accessing the store

updateHeaders

protected void updateHeaders()
                      throws MessagingException
Throws:
MessagingException

createInternetHeaders

protected InternetHeaders createInternetHeaders(java.io.InputStream in)
                                         throws MessagingException
Throws:
MessagingException

getHeaderAsAddresses

private InternetAddress[] getHeaderAsAddresses(java.lang.String header,
                                               boolean strict)
                                        throws MessagingException
Throws:
MessagingException

isStrictAddressing

private boolean isStrictAddressing()

setHeader

private void setHeader(java.lang.String header,
                       Address address)

setHeader

private void setHeader(java.lang.String header,
                       Address[] addresses)

addHeader

private void addHeader(java.lang.String header,
                       Address[] addresses)

getHeaderForRecipientType

private java.lang.String getHeaderForRecipientType(Message.RecipientType type)
                                            throws MessagingException
Throws:
MessagingException

getSingleHeader

private java.lang.String getSingleHeader(java.lang.String name)
                                  throws MessagingException
Throws:
MessagingException