Package totalcross.net.mail
Class Message
- java.lang.Object
-
- totalcross.net.mail.Part
-
- totalcross.net.mail.Message
-
public class Message extends Part
This class represents a MIME style e-mail message.- Since:
- TotalCross 1.13
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceMessage.RecipientType
-
Field Summary
Fields Modifier and Type Field Description java.lang.StringsubjectThe subject of this messagejava.lang.Stringuidlprotected VectorvFromprotected Vector[]vRecipients-
Fields inherited from class totalcross.net.mail.Part
ATTACHMENT, BINARY, content, contentHandler, disposition, fileName, headers, HTML, INLINE, mimeType, PLAIN
-
-
Constructor Summary
Constructors Constructor Description Message()Creates a new empty message.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddFrom(Address[] addresses)Add these addresses to the existing "From" attribute.voidaddHeader(java.lang.String name, java.lang.String value)Add this value to the existing values for this header name.voidaddRecipient(int type, Address address)Add this recipient address to the existing ones of the given type.voidaddRecipients(int type, Address[] addresses)Add these recipient addresses to the existing ones of the given type.voiddelete()Mark this message as deleted, removing it from the parent folder.Address[]getFrom()Returns the "From" attribute.Messagereply(boolean replyToAll)Get a new Message suitable for a reply to this message.voidsetFrom(Address address)Set the "From" attribute in this Message.voidwriteTo(Stream stream)Writes this part to the given Stream.-
Methods inherited from class totalcross.net.mail.Part
getContent, getContentType, setContent, setContent, setContent, setText
-
-
-
-
Method Detail
-
addHeader
public void addHeader(java.lang.String name, java.lang.String value)Description copied from class:PartAdd this value to the existing values for this header name.
-
addRecipient
public void addRecipient(int type, Address address)Add this recipient address to the existing ones of the given type.- Parameters:
type- the recipient typeaddress- the address- Throws:
java.lang.IllegalArgumentException- If the given recipient type is not validjava.lang.NullPointerException- if the given address is null- Since:
- TotalCross 1.13
-
addRecipients
public void addRecipients(int type, Address[] addresses)Add these recipient addresses to the existing ones of the given type.- Parameters:
type- the recipient typeaddresses- the addresses- Throws:
java.lang.IllegalArgumentException- If the given recipient type is not validjava.lang.NullPointerException- if addresses is null, or has a null value- Since:
- TotalCross 1.13
-
addFrom
public void addFrom(Address[] addresses)
Add these addresses to the existing "From" attribute.- Parameters:
addresses- the senders- Since:
- TotalCross 1.22
-
setFrom
public void setFrom(Address address)
Set the "From" attribute in this Message.- Parameters:
address- the sender- Since:
- TotalCross 1.22
-
getFrom
public Address[] getFrom()
Returns the "From" attribute. The "From" attribute contains the identity of the person(s) who wished this message to be sent. In certain implementations, this may be different from the entity that actually sent the message. This method returns null if this attribute is not present in this message. Returns an empty array if this attribute is present, but contains no addresses.- Returns:
- array of Address objects
- Since:
- TotalCross 1.22
-
writeTo
public void writeTo(Stream stream) throws MessagingException
Description copied from class:PartWrites this part to the given Stream. The output is typically an aggregation of the Part attributes and an appropriately encoded byte stream from its 'content'. Classes that extends the Part class decide on the appropriate encoding algorithm to be used. The received Stream is typically used for sending.- Overrides:
writeToin classPart- Parameters:
stream- the output stream that will receive this part's encoded representation- Throws:
MessagingException- if an error occurs fetching the data to be written
-
delete
public void delete() throws MessagingExceptionMark this message as deleted, removing it from the parent folder.- Throws:
MessagingException- Since:
- TotalCross 1.13
-
reply
public Message reply(boolean replyToAll) throws AddressException
Get a new Message suitable for a reply to this message. The new Message will have its attributes and headers set up appropriately. Note that this new message object will be empty, that is, it will not have a "content". These will have to be suitably filled in by the client. If replyToAll is set, the new Message will be addressed to all recipients of this message. Otherwise, the reply will be addressed to only the sender of this message. The "Subject" field is filled in with the original subject prefixed with "Re:" (unless it already starts with "Re:"). The reply message will use the same session as this message. NOTE: The replyToAll feature is NOT supported yet, messages returned by this method will contain only the original sender as recipient.- Parameters:
replyToAll- reply should be sent to all recipients of this message- Returns:
- the reply Message
- Throws:
AddressException- Since:
- TotalCross 1.13
-
-