MailMessage

Inheritance: java.lang.Object, com.aspose.email.IPreferredTextEncodingProviderInternal

All Implemented Interfaces: com.aspose.ms.System.IDisposable, java.io.Closeable, com.aspose.email.IPreferredTextEncodingProvider, com.aspose.email.IMessage, com.aspose.ms.System.Collections.Generic.IGenericEnumerable

public class MailMessage extends IPreferredTextEncodingProviderInternal implements System.IDisposable, Closeable, IPreferredTextEncodingProvider, IMessage, System.Collections.Generic.IGenericEnumerable<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.

Constructors

Constructor Description
MailMessage(String from, String to) Initializes a new instance of the MailMessage class
MailMessage() Initializes a new instance of the MailMessage class
MailMessage(boolean increaseCredit) 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
MailMessage(MailAddress from, MailAddress to) Initializes a new instance of the MailMessage class

Methods

Method Description
getPreamble() Gets or sets a preamble text.
setPreamble(String value) Gets or sets a preamble text.
getEpilogue() Gets or sets an epilogue text.
setEpilogue(String value) Gets or sets an epilogue text.
getPreferredTextEncoding() Gets or sets preferred encoding for all text properties
setPreferredTextEncoding(Charset value) Gets or sets preferred encoding for all text properties
getFrom() Gets or sets the from address
setFrom(MailAddress value) Gets or sets the from address
getSender() Gets or sets sender address
setSender(MailAddress value) Gets or sets sender address
getReversePath() Gets or sets ReversePath address
setReversePath(MailAddress value) Gets or sets ReversePath address
getReplyToList() Gets or sets the list of addresses to reply to for the mail message
setReplyToList(MailAddressCollection value) Gets or sets the list of addresses to reply to for the mail message
getTo() Gets or sets the address collection that contains the recipients of message
setTo(MailAddressCollection value) Gets or sets the address collection that contains the recipients of message
getBcc() Gets or sets the address collection that contains the BCC recipients of message
setBcc(MailAddressCollection value) Gets or sets the address collection that contains the BCC recipients of message
getCC() Gets or sets the address collection that contains the CC recipients
setCC(MailAddressCollection value) Gets or sets the address collection that contains the CC recipients
getPriority() Gets or sets the priority of message
setPriority(MailPriority value) Gets or sets the priority of message
getSensitivity() Gets or sets the sensitivity of message
setSensitivity(MailSensitivity value) Gets or sets the sensitivity of message
getDeliveryNotificationOptions() Gets or sets the delivery notifications
setDeliveryNotificationOptions(int value) Gets or sets the delivery notifications
getSubject() Gets or sets the subject line
setSubject(String value) Gets or sets the subject line
getTimeZoneOffset() Gets or sets the Coordinated Universal Time (UTC) offset for the message dates.
setTimeZoneOffset(double value) Gets or sets the Coordinated Universal Time (UTC) offset for the message dates.
getDate() Gets or sets the date of message Specifies the date and time at which the creator of the message indicated that the message was complete and ready to enter the mail delivery system.
getLocalDate() Gets the local date of message
isLocalDate() Defines if date is local date
setDate(Date value) Gets or sets the date of message
getMessageId() Gets or sets the message id
setMessageId(String value) Gets or sets the message id
getXMailer() Gets or sets the X-Mailer the software that created the e-mail message
setXMailer(String value) Gets or sets the X-Mailer the software that created the e-mail message
getSubjectEncoding() Gets or sets the encoding of subject
setSubjectEncoding(Charset value) Gets or sets the encoding of subject
getHeaders() Gets headers collection of message
getHtmlBody() Gets or sets html body
setHtmlBody(String value) Gets or sets html body
getBody() Gets or sets the plain text representation of message’s body.
setBody(String value) Gets or sets the plain text representation of message’s body.
getHtmlBodyText() Gets the message htmlbody as plain text.
getBodyEncoding() Gets or sets encoding of body
setBodyEncoding(Charset value) Gets or sets encoding of body
isBodyHtml() Gets or sets a value indicating whether the message body is in Html
isBodyHtml(boolean value) Gets or sets a value indicating whether the message body is in Html
isSigned() Gets a value indicating whether the message is signed.
isEncrypted() Gets a value indicating whether the message is encrypted.
isReadOnly() Gets a value indicating whether the message is read only
getItemId() Represents identification information about message in a mailbox.
isDraft() Gets or sets value that indicates whether or not a message has been sent.
isDraft(boolean value) Gets or sets value that indicates whether or not a message has been sent.
getAttachments() Gets the collection of attachments of message
getLinkedResources() Gets the collection of linked resources of message
getAlternateViews() Gets the collection of alternate views of message
getBodyType() Gets the type of the body.
getOriginalIsTnef() Gets a value indicating whether original EML message is in TNEF format.
getCc() Gets CC recipients
setFrom(IMailAddress value) Sets from address
load(String fileName) Load message from file
load(InputStream stream) Load message from stream
load(String fileName, LoadOptions options) Load message from file with additional options.
load(InputStream stream, LoadOptions options) Load message from stream with additional options.
validateMessage(String fileName) Validate eml message for corresponding to mime specification.
validateMessage(InputStream stream) Validate eml message for corresponding to mime specification.
importMessage(InputStream stream) Imports message from stream
deepClone() Clones this instance
recomposeTnefContent() Composes the TNEF content.
setHtmlBody(String value, boolean detectEncoding) Sets html body.
getHtmlBodyText(boolean showUrl) Gets the message html body as plain text.
getHtmlBodyText(HyperlinkRenderingCallback hyperlinkRenderingCallback) Gets the message htmlbody as plain text.
save(String fileName) Save message as a file
save(String fileName, SaveOptions options) Save message as a file with additional options.
save(OutputStream stream, SaveOptions options) Save message as a stream with additional options.
toString() Returns a string that represents the current object.
hashCode() Returns a hash code for object
equals(Object obj) Determines whether the specified Object is equal to the current Object.
save(OutputStream stream) Save message as a stream
getReadReceiptTo() Gets or sets the read receipt address.
setReadReceiptTo(MailAddressCollection value) Gets or sets the read receipt address.
createReadReceipt(String from, String bodyText) Creates the read receipt.
addAlternateView(AlternateView view) Add an alternate view to message
addAttachment(Attachment attachment) Add an attachment to message
dispose() Releases all resources used by the MailMessage
close()
attachSignature(byte[] certificateRawData, String certificatePassword, boolean detached) Creates a signed message.
attachSignature(System.Security.Cryptography.X509Certificates.X509Certificate2 certificate, boolean detached) Creates a signed message.
attachSignature(byte[] certificateRawData, String certificatePassword) Creates a signed message.
attachSignature(System.Security.Cryptography.X509Certificates.X509Certificate2 certificate)
checkSignature(String fileName) Checks the signature of the specified eml file.
checkSignature(InputStream stream) Checks the signature of the specified eml message.
checkSignature() Checking signature exsisting MailMessage.
checkSignatureCert() Checking signature exsisting MailMessage.
removeSignature() Remove signature
decrypt() Decrypts this message
decrypt(byte[] certificateRawData, String certificatePassword) Decrypts this message
decrypt(System.Security.Cryptography.X509Certificates.X509Certificate2 certificate)
encrypt(byte[] certificateRawData, String certificatePassword) Encrypts this message
encrypt(System.Security.Cryptography.X509Certificates.X509Certificate2 certificate)
encrypt(System.Security.Cryptography.X509Certificates.X509Certificate2[] certificates) Encrypts this message
dKIMSign(System.Security.Cryptography.RSACryptoServiceProvider rsa, DKIMSignatureInfo signatureInfo) Signs this message using DKIM (DomainKeys Identified Mail) signature.
checkBounced() Checks whether this message can be treated as a bounce message.
iterator() Returns an enumerator that iterates through a collection.

MailMessage(String from, String to)

public MailMessage(String from, String to)

Initializes a new instance of the MailMessage class

Parameters:

Parameter Type Description
from java.lang.String Sender address
to java.lang.String Recipient address

MailMessage()

public MailMessage()

Initializes a new instance of the MailMessage class

MailMessage(boolean increaseCredit)

public MailMessage(boolean increaseCredit)

Initializes a new instance of the MailMessage class

Parameters:

Parameter Type Description
increaseCredit boolean

MailMessage(String from, String to, String subject, String body)

public MailMessage(String from, String to, String subject, String body)

Initializes a new instance of the MailMessage class

Parameters:

Parameter Type Description
from java.lang.String Sender address
to java.lang.String Recipient address
subject java.lang.String Message subject
body java.lang.String Message body

MailMessage(MailAddress from, MailAddress to)

public MailMessage(MailAddress from, MailAddress to)

Initializes a new instance of the MailMessage class

Parameters:

Parameter Type Description
from MailAddress Sender address
to MailAddress Recipient address

getPreamble()

public final String getPreamble()

Gets or sets a preamble text. It is located before the first boundary and generally includes an explanatory note to non-MIME conformant readers.

Value: The string value that represents a preamble.

Returns: java.lang.String

setPreamble(String value)

public final void setPreamble(String value)

Gets or sets a preamble text. It is located before the first boundary and generally includes an explanatory note to non-MIME conformant readers.

Value: The string value that represents a preamble.

Parameters:

Parameter Type Description
value java.lang.String

getEpilogue()

public final String getEpilogue()

Gets or sets an epilogue text. It is located after the last boundary.

Value: The string value that represents an epilogue.

Returns: java.lang.String

setEpilogue(String value)

public final void setEpilogue(String value)

Gets or sets an epilogue text. It is located after the last boundary.

Value: The string value that represents an epilogue.

Parameters:

Parameter Type Description
value java.lang.String

getPreferredTextEncoding()

public final Charset getPreferredTextEncoding()

Gets or sets preferred encoding for all text properties

Returns: java.nio.charset.Charset

setPreferredTextEncoding(Charset value)

public final void setPreferredTextEncoding(Charset value)

Gets or sets preferred encoding for all text properties

Parameters:

Parameter Type Description
value java.nio.charset.Charset

getFrom()

public MailAddress getFrom()

Gets or sets the from address

Returns: MailAddress

setFrom(MailAddress value)

public void setFrom(MailAddress value)

Gets or sets the from address

Parameters:

Parameter Type Description
value MailAddress

getSender()

public MailAddress getSender()

Gets or sets sender address

Returns: MailAddress

setSender(MailAddress value)

public void setSender(MailAddress value)

Gets or sets sender address

Parameters:

Parameter Type Description
value MailAddress

getReversePath()

public MailAddress getReversePath()

Gets or sets ReversePath address

Returns: MailAddress

setReversePath(MailAddress value)

public void setReversePath(MailAddress value)

Gets or sets ReversePath address

Parameters:

Parameter Type Description
value MailAddress

getReplyToList()

public MailAddressCollection getReplyToList()

Gets or sets the list of addresses to reply to for the mail message

Returns: MailAddressCollection

setReplyToList(MailAddressCollection value)

public void setReplyToList(MailAddressCollection value)

Gets or sets the list of addresses to reply to for the mail message

Parameters:

Parameter Type Description
value MailAddressCollection

getTo()

public MailAddressCollection getTo()

Gets or sets the address collection that contains the recipients of message

Returns: MailAddressCollection

setTo(MailAddressCollection value)

public void setTo(MailAddressCollection value)

Gets or sets the address collection that contains the recipients of message

Parameters:

Parameter Type Description
value MailAddressCollection

getBcc()

public MailAddressCollection getBcc()

Gets or sets the address collection that contains the BCC recipients of message

Returns: MailAddressCollection

setBcc(MailAddressCollection value)

public void setBcc(MailAddressCollection value)

Gets or sets the address collection that contains the BCC recipients of message

Parameters:

Parameter Type Description
value MailAddressCollection

getCC()

public MailAddressCollection getCC()

Gets or sets the address collection that contains the CC recipients

Returns: MailAddressCollection

setCC(MailAddressCollection value)

public void setCC(MailAddressCollection value)

Gets or sets the address collection that contains the CC recipients

Parameters:

Parameter Type Description
value MailAddressCollection

getPriority()

public MailPriority getPriority()

Gets or sets the priority of message

Returns: MailPriority

setPriority(MailPriority value)

public void setPriority(MailPriority value)

Gets or sets the priority of message

Parameters:

Parameter Type Description
value MailPriority

getSensitivity()

public MailSensitivity getSensitivity()

Gets or sets the sensitivity of message

Returns: MailSensitivity

setSensitivity(MailSensitivity value)

public void setSensitivity(MailSensitivity value)

Gets or sets the sensitivity of message

Parameters:

Parameter Type Description
value MailSensitivity

getDeliveryNotificationOptions()

public int getDeliveryNotificationOptions()

Gets or sets the delivery notifications

Returns: int

setDeliveryNotificationOptions(int value)

public void setDeliveryNotificationOptions(int value)

Gets or sets the delivery notifications

Parameters:

Parameter Type Description
value int

getSubject()

public String getSubject()

Gets or sets the subject line

Returns: java.lang.String

setSubject(String value)

public void setSubject(String value)

Gets or sets the subject line

Parameters:

Parameter Type Description
value java.lang.String

getTimeZoneOffset()

public final double getTimeZoneOffset()

Gets or sets the Coordinated Universal Time (UTC) offset for the message dates. This property defines the time zone difference, between the local time and UTC.

Returns: double - A number of milliseconds.

setTimeZoneOffset(double value)

public final void setTimeZoneOffset(double value)

Gets or sets the Coordinated Universal Time (UTC) offset for the message dates. This property defines the time zone difference, between the local time and UTC.

Parameters:

Parameter Type Description
value double A number of milliseconds.

getDate()

public Date getDate()

Gets or sets the date of message Specifies the date and time at which the creator of the message indicated that the message was complete and ready to enter the mail delivery system.

Returns: java.util.Date

getLocalDate()

public Date getLocalDate()

Gets the local date of message

Returns: java.util.Date - A local date of message

isLocalDate()

public boolean isLocalDate()

Defines if date is local date

Returns: boolean - true if date is local date

setDate(Date value)

public void setDate(Date value)

Gets or sets the date of message

Parameters:

Parameter Type Description
value java.util.Date

getMessageId()

public String getMessageId()

Gets or sets the message id

Returns: java.lang.String

setMessageId(String value)

public void setMessageId(String value)

Gets or sets the message id

Parameters:

Parameter Type Description
value java.lang.String

getXMailer()

public String getXMailer()

Gets or sets the X-Mailer the software that created the e-mail message

Returns: java.lang.String

setXMailer(String value)

public void setXMailer(String value)

Gets or sets the X-Mailer the software that created the e-mail message

Parameters:

Parameter Type Description
value java.lang.String

getSubjectEncoding()

public Charset getSubjectEncoding()

Gets or sets the encoding of subject

Returns: java.nio.charset.Charset

setSubjectEncoding(Charset value)

public void setSubjectEncoding(Charset value)

Gets or sets the encoding of subject

Parameters:

Parameter Type Description
value java.nio.charset.Charset

getHeaders()

public HeaderCollection getHeaders()

Gets headers collection of message

Returns: HeaderCollection

getHtmlBody()

public String getHtmlBody()

Gets or sets html body

Returns: java.lang.String

setHtmlBody(String value)

public void setHtmlBody(String value)

Gets or sets html body

Parameters:

Parameter Type Description
value java.lang.String

getBody()

public String getBody()

Gets or sets the plain text representation of message’s body. If the text/plain part is present in a message, the propery returns its text data. Otherwise, property returns the text content of the HtmlBody property without html markup.

Returns: java.lang.String

setBody(String value)

public void setBody(String value)

Gets or sets the plain text representation of message’s body. If the text/plain part is present in a message, the propery returns its text data. Otherwise, property returns the text content of the HtmlBody property without html markup.

Parameters:

Parameter Type Description
value java.lang.String

getHtmlBodyText()

public final String getHtmlBodyText()

Gets the message htmlbody as plain text.

Returns: java.lang.String

getBodyEncoding()

public Charset getBodyEncoding()

Gets or sets encoding of body

Returns: java.nio.charset.Charset

setBodyEncoding(Charset value)

public void setBodyEncoding(Charset value)

Gets or sets encoding of body

Parameters:

Parameter Type Description
value java.nio.charset.Charset

isBodyHtml()

public boolean isBodyHtml()

Gets or sets a value indicating whether the message body is in Html

Returns: boolean

isBodyHtml(boolean value)

public void isBodyHtml(boolean value)

Gets or sets a value indicating whether the message body is in Html

Parameters:

Parameter Type Description
value boolean

isSigned()

public boolean isSigned()

Gets a value indicating whether the message is signed.

Returns: boolean

isEncrypted()

public boolean isEncrypted()

Gets a value indicating whether the message is encrypted.

Returns: boolean

isReadOnly()

public boolean isReadOnly()

Gets a value indicating whether the message is read only

Returns: boolean

getItemId()

public MailboxInfo getItemId()

Represents identification information about message in a mailbox.

Returns: MailboxInfo

isDraft()

public boolean isDraft()

Gets or sets value that indicates whether or not a message has been sent.

Returns: boolean

isDraft(boolean value)

public void isDraft(boolean value)

Gets or sets value that indicates whether or not a message has been sent.

Parameters:

Parameter Type Description
value boolean

getAttachments()

public AttachmentCollection getAttachments()

Gets the collection of attachments of message

Returns: AttachmentCollection

getLinkedResources()

public LinkedResourceCollection getLinkedResources()

Gets the collection of linked resources of message

Returns: LinkedResourceCollection

getAlternateViews()

public AlternateViewCollection getAlternateViews()

Gets the collection of alternate views of message

Returns: AlternateViewCollection

getBodyType()

public final int getBodyType()

Gets the type of the body.

Returns: int

getOriginalIsTnef()

public boolean getOriginalIsTnef()

Gets a value indicating whether original EML message is in TNEF format.

Returns: boolean

getCc()

public final System.Collections.Generic.IGenericCollection<MailAddress> getCc()

Gets CC recipients

Returns: com.aspose.ms.System.Collections.Generic.IGenericCollection<com.aspose.email.MailAddress>

setFrom(IMailAddress value)

public final void setFrom(IMailAddress value)

Sets from address

Parameters:

Parameter Type Description
value IMailAddress A from address

load(String fileName)

public static MailMessage load(String fileName)

Load message from file

Parameters:

Parameter Type Description
fileName java.lang.String Message file name. The message file must be in eml or msg format.

Returns: MailMessage - E-mail message

load(InputStream stream)

public static MailMessage load(InputStream stream)

Load message from stream

Parameters:

Parameter Type Description
stream java.io.InputStream Stream that represents message in eml or msg format

Returns: MailMessage - E-mail message

load(String fileName, LoadOptions options)

public static MailMessage load(String fileName, LoadOptions options)

Load message from file with additional options.

Parameters:

Parameter Type Description
fileName java.lang.String Source file pathString.
options LoadOptions Additional options LoadOptions.

Returns: MailMessage - Mail messageMailMessage.

load(InputStream stream, LoadOptions options)

public static MailMessage load(InputStream stream, LoadOptions options)

Load message from stream with additional options.

Parameters:

Parameter Type Description
stream java.io.InputStream Source streamjava.io.InputStream.
options LoadOptions Additional options LoadOptions.

Returns: MailMessage - Mail messageMailMessage.

validateMessage(String fileName)

public static EmlValidationErrorCollection validateMessage(String fileName)

Validate eml message for corresponding to mime specification.

Parameters:

Parameter Type Description
fileName java.lang.String A file name (eml).

Returns: EmlValidationErrorCollection - A EmlValidationErrorCollection containing the found validation error messages.

validateMessage(InputStream stream)

public static EmlValidationErrorCollection validateMessage(InputStream stream)

Validate eml message for corresponding to mime specification.

Parameters:

Parameter Type Description
stream java.io.InputStream A stream containing the message in eml format.

Returns: EmlValidationErrorCollection - A EmlValidationErrorCollection containing the found validation error messages.

importMessage(InputStream stream)

public void importMessage(InputStream stream)

Imports message from stream

Parameters:

Parameter Type Description
stream java.io.InputStream System.IO.Stream

deepClone()

public MailMessage deepClone()

Clones this instance

Returns: MailMessage - MailMessage that is a copy of the current instance

recomposeTnefContent()

public final 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.

setHtmlBody(String value, boolean detectEncoding)

public void setHtmlBody(String value, boolean detectEncoding)

Sets html body.

Parameters:

Parameter Type Description
value java.lang.String The HtmlBody content text.
detectEncoding boolean Detect body encoding if no encoding is specified for the MailMessage.

getHtmlBodyText(boolean showUrl)

public String getHtmlBodyText(boolean showUrl)

Gets the message html body as plain text. This method parses the HtmlBody property and returns plain text content ignoring the html markup.

Parameters:

Parameter Type Description
showUrl boolean Defines need to show URL in text.

Returns: java.lang.String

getHtmlBodyText(HyperlinkRenderingCallback hyperlinkRenderingCallback)

public String getHtmlBodyText(HyperlinkRenderingCallback hyperlinkRenderingCallback)

Gets the message htmlbody as plain text.

Parameters:

Parameter Type Description
hyperlinkRenderingCallback HyperlinkRenderingCallback Reference to custom method for handling rendering of hyperlink.

Returns: java.lang.String - Result string of custom handling rendering of hyperlink.

save(String fileName)

public void save(String fileName)

Save message as a file

Parameters:

Parameter Type Description
fileName java.lang.String Name of a file to save message.

save(String fileName, SaveOptions options)

public void save(String fileName, SaveOptions options)

Save message as a file with additional options.

Parameters:

Parameter Type Description
fileName java.lang.String Stream into which message is saved.
options SaveOptions Additional options for savingSaveOptions.

save(OutputStream stream, SaveOptions options)

public void save(OutputStream stream, SaveOptions options)

Save message as a stream with additional options.

Parameters:

Parameter Type Description
stream java.io.OutputStream Stream into which message is saved.
options SaveOptions Additional options for savingSaveOptions.

toString()

public String toString()

Returns a string that represents the current object.

Returns: java.lang.String - A string that represents the current object.

hashCode()

public int hashCode()

Returns a hash code for object

Returns: int -

equals(Object obj)

public boolean equals(Object obj)

Determines whether the specified Object is equal to the current Object.

Parameters:

Parameter Type Description
obj java.lang.Object The Object to compare with the current Object.

Returns: boolean - Returns a boolean indicating if the passed in object obj is Equal to this.

save(OutputStream stream)

public void save(OutputStream stream)

Save message as a stream

Parameters:

Parameter Type Description
stream java.io.OutputStream Stream into which message is saved

getReadReceiptTo()

public final MailAddressCollection getReadReceiptTo()

Gets or sets the read receipt address.

Value: The MailAddressCollection that represents

Returns: MailAddressCollection

setReadReceiptTo(MailAddressCollection value)

public final void setReadReceiptTo(MailAddressCollection value)

Gets or sets the read receipt address.

Value: The MailAddressCollection that represents

Parameters:

Parameter Type Description
value MailAddressCollection

createReadReceipt(String from, String bodyText)

public final MailMessage createReadReceipt(String from, String bodyText)

Creates the read receipt.

Parameters:

Parameter Type Description
from java.lang.String String that represents the sender address.
bodyText java.lang.String The message body text. The default message body text will be applied if this parameter is null or empty.

Returns: MailMessage - A newly created MailMessage that represents the read receipt.

addAlternateView(AlternateView view)

public void addAlternateView(AlternateView view)

Add an alternate view to message

Parameters:

Parameter Type Description
view AlternateView Alternate view for adding

addAttachment(Attachment attachment)

public void addAttachment(Attachment attachment)

Add an attachment to message

Parameters:

Parameter Type Description
attachment Attachment Attachment for adding

dispose()

public final void dispose()

Releases all resources used by the MailMessage

close()

public void close()

attachSignature(byte[] certificateRawData, String certificatePassword, boolean detached)

public MailMessage attachSignature(byte[] certificateRawData, String certificatePassword, boolean detached)

Creates a signed message. Creates a read-only copy of the specified MailMessage and adds a digital signature to it.

Parameters:

Parameter Type Description
certificateRawData byte[] X.509 certificate.
certificatePassword java.lang.String The password required to access the X.509 certificate data
detached boolean .If detached is true, the signature is detached.If detached is false(the default), the signature is not detached.

Returns: MailMessage - The signed MailMessage.

attachSignature(System.Security.Cryptography.X509Certificates.X509Certificate2 certificate, boolean detached)

public MailMessage attachSignature(System.Security.Cryptography.X509Certificates.X509Certificate2 certificate, boolean detached)

Creates a signed message. Creates a read-only copy of the specified MailMessage and adds a digital signature to it.

Parameters:

Parameter Type Description
certificate com.aspose.ms.System.Security.Cryptography.X509Certificates.X509Certificate2 X.509 certificate.
detached boolean .If detached is true, the signature is detached.If detached is false(the default), the signature is not detached.

Returns: MailMessage -

attachSignature(byte[] certificateRawData, String certificatePassword)

public MailMessage attachSignature(byte[] certificateRawData, String certificatePassword)

Creates a signed message. Creates a read-only copy of the specified MailMessage and adds a digital signature to it.

Parameters:

Parameter Type Description
certificateRawData byte[] X.509 certificate.
certificatePassword java.lang.String The password required to access the X.509 certificate data

Returns: MailMessage - The signed MailMessage.

attachSignature(System.Security.Cryptography.X509Certificates.X509Certificate2 certificate)

public MailMessage attachSignature(System.Security.Cryptography.X509Certificates.X509Certificate2 certificate)

Parameters:

Parameter Type Description
certificate com.aspose.ms.System.Security.Cryptography.X509Certificates.X509Certificate2

Returns: MailMessage

checkSignature(String fileName)

public static boolean checkSignature(String fileName)

Checks the signature of the specified eml file.

Parameters:

Parameter Type Description
fileName java.lang.String A file name (eml).

Returns: boolean - ``` True ``` if signature is valid; otherwise, ``` false ```.

checkSignature(InputStream stream)

public static boolean checkSignature(InputStream stream)

Checks the signature of the specified eml message.

Parameters:

Parameter Type Description
stream java.io.InputStream A stream containing the message in eml format.

Returns: boolean - ``` True ``` if signature is valid; otherwise, ``` false ```.

checkSignature()

public String[] checkSignature()

Checking signature exsisting MailMessage.

Returns: java.lang.String[] - X.509 signers certificates

checkSignatureCert()

public System.Security.Cryptography.X509Certificates.X509Certificate2[] checkSignatureCert()

Checking signature exsisting MailMessage.

Returns: com.aspose.ms.System.Security.Cryptography.X509Certificates.X509Certificate2[] - X.509 signers certificates

removeSignature()

public MailMessage removeSignature()

Remove signature

Returns: MailMessage - E-mail message

decrypt()

public MailMessage decrypt()

Decrypts this message

Returns: MailMessage - E-mail message

decrypt(byte[] certificateRawData, String certificatePassword)

public MailMessage decrypt(byte[] certificateRawData, String certificatePassword)

Decrypts this message

Parameters:

Parameter Type Description
certificateRawData byte[] System.Security.Cryptography.X509Certificates.X509Certificate2
certificatePassword java.lang.String The password required to access the X.509 certificate data

Returns: MailMessage - E-mail message

decrypt(System.Security.Cryptography.X509Certificates.X509Certificate2 certificate)

public MailMessage decrypt(System.Security.Cryptography.X509Certificates.X509Certificate2 certificate)

Parameters:

Parameter Type Description
certificate com.aspose.ms.System.Security.Cryptography.X509Certificates.X509Certificate2

Returns: MailMessage

encrypt(byte[] certificateRawData, String certificatePassword)

public MailMessage encrypt(byte[] certificateRawData, String certificatePassword)

Encrypts this message

Parameters:

Parameter Type Description
certificateRawData byte[] X509 certificate to encrypt message
certificatePassword java.lang.String

Returns: MailMessage - Encrypted email message

encrypt(System.Security.Cryptography.X509Certificates.X509Certificate2 certificate)

public MailMessage encrypt(System.Security.Cryptography.X509Certificates.X509Certificate2 certificate)

Parameters:

Parameter Type Description
certificate com.aspose.ms.System.Security.Cryptography.X509Certificates.X509Certificate2

Returns: MailMessage

encrypt(System.Security.Cryptography.X509Certificates.X509Certificate2[] certificates)

public MailMessage encrypt(System.Security.Cryptography.X509Certificates.X509Certificate2[] certificates)

Encrypts this message

Parameters:

Parameter Type Description
certificates com.aspose.ms.System.Security.Cryptography.X509Certificates.X509Certificate2[] Array with X509 certificates to encrypt message

Returns: MailMessage - Encrypted email message

dKIMSign(System.Security.Cryptography.RSACryptoServiceProvider rsa, DKIMSignatureInfo signatureInfo)

public MailMessage dKIMSign(System.Security.Cryptography.RSACryptoServiceProvider rsa, DKIMSignatureInfo signatureInfo)

Signs this message using DKIM (DomainKeys Identified Mail) signature.

Parameters:

Parameter Type Description
rsa com.aspose.ms.System.Security.Cryptography.RSACryptoServiceProvider RSA class containing private key used for signing.
signatureInfo DKIMSignatureInfo DKIM signature information.

Returns: MailMessage -

checkBounced()

public BounceResult checkBounced()

Checks whether this message can be treated as a bounce message.

Returns: BounceResult - Result of checkingBounceResult.

iterator()

public final System.Collections.Generic.IGenericEnumerator<MailMessage> iterator()

Returns an enumerator that iterates through a collection.

Returns: com.aspose.ms.System.Collections.Generic.IGenericEnumerator<com.aspose.email.MailMessage> - An IEnumerator object that can be used to iterate through the collection.