|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.aspose.email.MailMessage
public class MailMessage
Represents an e-mail message. It allows to access message properties, ex. subject, body, sender and recipients addreses, etc. Also it can be sent and delivered by means of supported mail protocols.
Constructor Summary | |
---|---|
MailMessage()
Initializes a new instance of the MailMessage class |
|
MailMessage(MailAddress from,
MailAddress to)
Initializes a new instance of the MailMessage class |
|
MailMessage(String from,
String to)
Initializes a new instance of the MailMessage class |
|
MailMessage(String from,
String to,
String subject,
String body)
Initializes a new instance of the MailMessage class |
Method Summary | |
---|---|
void |
addAlternateView(AlternateView view)
Add an alternate view to message |
void |
addAttachment(Attachment attachment)
Add an attachment to message |
void |
addCalendar(Calendar calendar)
Deprecated. |
MailMessage |
deepClone()
Clones this instance |
void |
dispose()
Releases all resources used by the MailMessage |
AlternateViewCollection |
getAlternateViews()
Gets the collection of alternate views of message |
AttachmentCollection |
getAttachments()
Gets the collection of attachments of message |
MailAddressCollection |
getBcc()
Gets or sets the address collection that contains the BCC recipients of message |
String |
getBody()
Gets or sets the message body |
Charset |
getBodyEncoding()
|
int |
getBodyType()
Gets the type of the body. |
Collection |
getCc()
Gets CC recipients |
MailAddressCollection |
getCC()
Gets or sets the address collection that contains the CC recipients |
Date |
getDate()
|
int |
getDeliveryNotificationOptions()
Gets or sets the delivery notifications |
MailAddress |
getFrom()
Gets or sets the from address |
HeaderCollection |
getHeaders()
Gets headers collection of message |
String |
getHtmlBody()
Gets or sets html body |
LinkedResourceCollection |
getLinkedResources()
Gets the collection of linked resources of message |
String |
getMessageId()
Gets or sets the message id |
Charset |
getPreferredTextEncoding()
|
com.aspose.email.ms.System.Text.Encoding |
getPreferredTextEncodingInternal()
Gets or sets preferred encoding for all text properties |
boolean |
getPreserveOriginalDates()
Gets or sets a value indicating whether it is necessary to generate new saving and modification dates when saving a message |
MailPriority |
getPriority()
Gets or sets the priority of message |
MailAddress |
getReplyTo()
Deprecated. |
MailAddressCollection |
getReplyToList()
Gets or sets the list of addresses to reply to for the mail message |
MailAddress |
getReversePath()
Gets or sets ReversePath address |
MailAddress |
getSender()
Gets or sets sender address |
MailSensitivity |
getSensitivity()
Gets or sets the sensitivity of message |
String |
getSubject()
Gets or sets the subject line |
Charset |
getSubjectEncoding()
|
String |
getTextBody()
Gets or sets plain text body |
double |
getTimeZoneOffset()
Gets or sets the Coordinated Universal Time (UTC) offset (in milliseconds) for the message dates. |
MailAddressCollection |
getTo()
Gets or sets the address collection that contains the recipients of message |
boolean |
getWriteHeaderToMht()
Deprecated. |
boolean |
getWriteOutlineAttachmentsToMht()
Deprecated. |
String |
getXMailer()
Gets or sets the X-Mailer the software that created the e-mail message |
void |
importMessage(InputStream stream)
|
boolean |
isBodyHtml()
Gets or sets a value indicating whether the message body is in Html |
void |
isBodyHtml(boolean value)
|
boolean |
isReadOnly()
Gets a value indicating whether the message is read only |
boolean |
isSigned()
Gets a value indicating whether the message is signed |
Iterator<MailMessage> |
iterator()
|
static MailMessage |
load(InputStream stream)
|
static MailMessage |
load(InputStream stream,
int mode)
|
static MailMessage |
load(InputStream stream,
MessageFormat format)
|
static MailMessage |
load(String fileName)
Load message from file |
static MailMessage |
load(String fileName,
int mode)
Load message from file |
static MailMessage |
load(String fileName,
MessageFormat format)
Load message from stream |
static MailMessage |
loadFromTnef(InputStream stream)
|
static MailMessage |
loadFromTnef(String fileName)
Loads message from Transport Neutral Encapsulation Format (TNEF) data structure |
void |
recomposeTnefContent()
Composes the TNEF content. |
void |
save(OutputStream stream)
|
void |
save(OutputStream stream,
int mode)
|
void |
save(OutputStream stream,
MailMessageSaveType savetype)
|
void |
save(OutputStream stream,
MailMessageSaveType savetype,
int saveOptions)
|
void |
save(OutputStream stream,
MessageFormat format)
|
void |
save(OutputStream stream,
MessageFormat format,
int saveOptions)
|
void |
save(String fileName)
Save message as a file |
void |
save(String fileName,
int mode)
Save message as a file |
void |
save(String fileName,
MailMessageSaveType savetype)
Message saving into a file into one of the supported formats |
void |
save(String fileName,
MailMessageSaveType savetype,
int saveOptions)
Message saving into a file into one of the supported formats |
void |
save(String fileName,
MessageFormat format)
Message saving into a file into one of the supported formats |
void |
save(String fileName,
MessageFormat format,
int saveOptions)
Message saving into a file into one of the supported formats |
void |
setBcc(MailAddressCollection value)
|
void |
setBody(String value)
|
void |
setBodyEncoding(Charset value)
|
void |
setCC(MailAddressCollection value)
|
void |
setDate(Date value)
|
void |
setDeliveryNotificationOptions(int value)
|
void |
setFrom(IMailAddress value)
Gets or sets a from address |
void |
setFrom(MailAddress value)
|
void |
setHtmlBody(String value)
|
void |
setMessageId(String value)
|
void |
setPreferredTextEncoding(Charset value)
|
void |
setPreferredTextEncodingInternal(com.aspose.email.ms.System.Text.Encoding value)
|
void |
setPreserveOriginalDates(boolean value)
|
void |
setPriority(MailPriority value)
|
void |
setReplyTo(MailAddress value)
Deprecated. |
void |
setReplyToList(MailAddressCollection value)
|
void |
setReversePath(MailAddress value)
|
void |
setSender(MailAddress value)
|
void |
setSensitivity(MailSensitivity value)
|
void |
setSubject(String value)
|
void |
setSubjectEncoding(Charset value)
|
void |
setTextBody(String value)
|
void |
setTimeZoneOffset(double value)
Gets or sets the Coordinated Universal Time (UTC) offset (in milliseconds) for the message dates. |
void |
setTo(MailAddressCollection value)
|
void |
setWriteHeaderToMht(boolean value)
Deprecated. |
void |
setWriteOutlineAttachmentsToMht(boolean value)
Deprecated. |
void |
setXMailer(String value)
|
static EmlValidationErrorCollection |
validateMessage(InputStream stream)
|
static EmlValidationErrorCollection |
validateMessage(String fileName)
Validate eml message for corresponding to mime specification. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MailMessage(String from, String to)
Initializes a new instance of the MailMessage
class
from
- Sender addressto
- Recipient addresspublic MailMessage()
Initializes a new instance of the MailMessage
class
public MailMessage(String from, String to, String subject, String body)
Initializes a new instance of the MailMessage
class
from
- Sender addressto
- Recipient addresssubject
- Message subjectbody
- Message bodypublic MailMessage(MailAddress from, MailAddress to)
Initializes a new instance of the MailMessage
class
from
- Sender addressto
- Recipient addressMethod Detail |
---|
public com.aspose.email.ms.System.Text.Encoding getPreferredTextEncodingInternal()
Gets or sets preferred encoding for all text properties
public Charset getPreferredTextEncoding()
getPreferredTextEncoding
in interface IPreferredTextEncodingProvider
public void setPreferredTextEncodingInternal(com.aspose.email.ms.System.Text.Encoding value)
public void setPreferredTextEncoding(Charset value)
setPreferredTextEncoding
in interface IPreferredTextEncodingProvider
public MailAddress getFrom()
Gets or sets the from address
getFrom
in interface IMessage
public void setFrom(MailAddress value)
public MailAddress getSender()
Gets or sets sender address
public void setSender(MailAddress value)
public MailAddress getReversePath()
Gets or sets ReversePath address
public void setReversePath(MailAddress value)
@Deprecated public MailAddress getReplyTo()
Gets or sets the ReplyTo address
@Deprecated public void setReplyTo(MailAddress value)
public MailAddressCollection getReplyToList()
Gets or sets the list of addresses to reply to for the mail message
public void setReplyToList(MailAddressCollection value)
public MailAddressCollection getTo()
Gets or sets the address collection that contains the recipients of message
getTo
in interface IMessage
public void setTo(MailAddressCollection value)
public MailAddressCollection getBcc()
Gets or sets the address collection that contains the BCC recipients of message
getBcc
in interface IMessage
public void setBcc(MailAddressCollection value)
public MailAddressCollection getCC()
Gets or sets the address collection that contains the CC recipients
public void setCC(MailAddressCollection value)
public MailPriority getPriority()
Gets or sets the priority of message
public void setPriority(MailPriority value)
public MailSensitivity getSensitivity()
Gets or sets the sensitivity of message
public void setSensitivity(MailSensitivity value)
public int getDeliveryNotificationOptions()
Gets or sets the delivery notifications
public void setDeliveryNotificationOptions(int value)
public String getSubject()
Gets or sets the subject line
getSubject
in interface IMessage
public void setSubject(String value)
setSubject
in interface IMessage
public double getTimeZoneOffset()
Gets or sets the Coordinated Universal Time (UTC) offset (in milliseconds) for the message dates. This property defines the time zone difference, between the local time and UTC.
public void setTimeZoneOffset(double value)
Gets or sets the Coordinated Universal Time (UTC) offset (in milliseconds) for the message dates. This property defines the time zone difference, between the local time and UTC.
public Date getDate()
getDate
in interface IMessage
public void setDate(Date value)
public String getMessageId()
Gets or sets the message id
public void setMessageId(String value)
public String getXMailer()
Gets or sets the X-Mailer the software that created the e-mail message
public void setXMailer(String value)
public Charset getSubjectEncoding()
public void setSubjectEncoding(Charset value)
public HeaderCollection getHeaders()
Gets headers collection of message
public String getTextBody()
Gets or sets plain text body
public void setTextBody(String value)
public String getHtmlBody()
Gets or sets html body
getHtmlBody
in interface IMessage
public void setHtmlBody(String value)
setHtmlBody
in interface IMessage
public String getBody()
Gets or sets the message body
getBody
in interface IMessage
public void setBody(String value)
setBody
in interface IMessage
public Charset getBodyEncoding()
public void setBodyEncoding(Charset value)
public boolean isBodyHtml()
Gets or sets a value indicating whether the message body is in Html
public void isBodyHtml(boolean value)
public boolean isSigned()
Gets a value indicating whether the message is signed
public boolean isReadOnly()
Gets a value indicating whether the message is read only
public boolean getPreserveOriginalDates()
Gets or sets a value indicating whether it is necessary to generate new saving and modification dates when saving a message
public void setPreserveOriginalDates(boolean value)
public AttachmentCollection getAttachments()
Gets the collection of attachments of message
getAttachments
in interface IMessage
public LinkedResourceCollection getLinkedResources()
Gets the collection of linked resources of message
public AlternateViewCollection getAlternateViews()
Gets the collection of alternate views of message
@Deprecated public boolean getWriteHeaderToMht()
Gets or sets a value indicating whether header information should be written if message is being saved in mht format.
Default value is true
.
true
if header information should be written; otherwise, false
.
@Deprecated public void setWriteHeaderToMht(boolean value)
public int getBodyType()
Gets the type of the body.
getBodyType
in interface IMessage
@Deprecated public boolean getWriteOutlineAttachmentsToMht()
Gets or sets a value indicating whether outline attachments should be written if message is being saved in mht format.
Default value is true
.
true
if outline attachments should be written; otherwise, false
.
@Deprecated public void setWriteOutlineAttachmentsToMht(boolean value)
public Collection getCc()
Gets CC recipients
getCc
in interface IMessage
public void setFrom(IMailAddress value)
Gets or sets a from address
setFrom
in interface IMessage
com.aspose.email.ms.System.IllegalArgumentException
- Incorrect type of value
. Expected type is Aspose.Network.Mail.MailAddresspublic static MailMessage load(String fileName)
Load message from file
fileName
- Message file name. The message file must be in eml or msg format.
public static MailMessage load(InputStream stream)
public static MailMessage load(String fileName, int mode)
Load message from file
fileName
- Message file name (.eml)mode
- FileCompatibilityMode
that defines inner conversions that are necessarily to be done
public static MailMessage load(InputStream stream, int mode)
public static MailMessage load(InputStream stream, MessageFormat format)
public static MailMessage load(String fileName, MessageFormat format)
Load message from stream
fileName
- Message file name.
File must be in one of the suported formatsformat
- Message file format
com.aspose.email.ms.System.IllegalArgumentException
- If fileName
is null.
FormatNotSupportedException
- If format
is not supported.public static MailMessage loadFromTnef(InputStream stream)
public static MailMessage loadFromTnef(String fileName)
Loads message from Transport Neutral Encapsulation Format (TNEF) data structure
fileName
- Name of file containing message data in TNEF format
MailMessage
com.aspose.email.ms.System.IllegalArgumentException
- fileName
is null
or empty
public static EmlValidationErrorCollection validateMessage(String fileName)
Validate eml message for corresponding to mime specification.
fileName
- A file name (eml).
EmlValidationErrorCollection
containing the found validation error messages.
com.aspose.email.ms.System.IllegalArgumentException
- fileName
is null
or empty
.
com.aspose.email.ms.System.IO.FileNotFoundException
- The specified fileName
doesn't exist.public static EmlValidationErrorCollection validateMessage(InputStream stream)
public void importMessage(InputStream stream)
public MailMessage deepClone()
Clones this instance
public void save(String fileName, int mode)
Save message as a file
fileName
- Name of the filemode
- FileCompatibilityMode
that defines inner conversions that are necessarily to be done
public void recomposeTnefContent()
Composes the TNEF content. Note, that tnef attachment is composed if a message initially contained TNEF and was loaded without FileCompatibilityMode.PreserveTnefAttachments flag, That is this method doesn't create tnef message out of the regular one.
public void save(OutputStream stream, int mode)
public void save(String fileName)
Save message as a file
save
in interface IMessage
fileName
- File namepublic void save(OutputStream stream)
save
in interface IMessage
public void save(OutputStream stream, MessageFormat format)
public void save(OutputStream stream, MessageFormat format, int saveOptions)
public void save(OutputStream stream, MailMessageSaveType savetype)
save
in interface IMessage
public void save(OutputStream stream, MailMessageSaveType savetype, int saveOptions)
public void save(String fileName, MailMessageSaveType savetype)
Message saving into a file into one of the supported formats
save
in interface IMessage
fileName
- Full file namesavetype
- Format into which message is savedpublic void save(String fileName, MailMessageSaveType savetype, int saveOptions)
Message saving into a file into one of the supported formats
fileName
- Full file namesavetype
- Format into which message is savedsaveOptions
- Save optionspublic void save(String fileName, MessageFormat format)
Message saving into a file into one of the supported formats
fileName
- Full file nameformat
- Format into which message is savedpublic void save(String fileName, MessageFormat format, int saveOptions)
Message saving into a file into one of the supported formats
fileName
- Full file nameformat
- Format into which message is savedsaveOptions
- Save optionspublic void addAlternateView(AlternateView view)
Add an alternate view to message
view
- Alternate view for addingpublic void addAttachment(Attachment attachment)
Add an attachment to message
attachment
- Attachment for adding@Deprecated public void addCalendar(Calendar calendar)
public void dispose()
Releases all resources used by the MailMessage
dispose
in interface com.aspose.email.ms.System.IDisposable
public Iterator<MailMessage> iterator()
iterator
in interface Iterable<MailMessage>
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |