MailMessage
Contents
[
Hide
]MailMessage class
Inherits: Aspose::Email::IPreferredTextEncodingProvider, Aspose::Email::IMessage
Provides possibility to handle rendering of hyperlink in custom style.
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.
The following example shows how to create a new Email Message and save with SaveOptions .
var message = new MailMessage
{
// Set subject of the message, Html body and sender information
Subject = "New message created by Aspose.Email for .NET",
HtmlBody = "<b>This line is in bold.</b> <br/> <br/>" +
"<font color=blue>This line is in blue color</font>",
From = new MailAddress("from@domain.com", "Sender Name", false)
};
// Add TO recipients and Add CC recipients
message.To.Add(new MailAddress("to1@domain.com", "Recipient 1", false));
message.To.Add(new MailAddress("to2@domain.com", "Recipient 2", false));
message.CC.Add(new MailAddress("cc1@domain.com", "Recipient 3", false));
message.CC.Add(new MailAddress("cc2@domain.com", "Recipient 4", false));
// Save message to EML, EMLX, MSG and MHTML formats
message.Save("CreateNewMailMessage_out.eml", SaveOptions.DefaultEml);
message.Save("CreateNewMailMessage_out.emlx", SaveOptions.CreateSaveOptions(MailMessageSaveType.EmlxFormat));
message.Save("CreateNewMailMessage_out.msg", SaveOptions.DefaultMsgUnicode);
message.Save("CreateNewMailMessage_out.mhtml", SaveOptions.DefaultMhtml);
' Create a new instance of MailMessage class
Dim message As MailMessage = New MailMessage()
' Set subject of the message, Html body and sender information
message.Subject = "New message created by Aspose.Email for .NET"
message.HtmlBody = "<b>This line is in bold.</b> <br/> <br/>" & "<font color=blue>This line is in blue color</font>"
message.From = New MailAddress("from@domain.com", "Sender Name", False)
' Add TO recipients and Add CC recipients
message.[To].Add(New MailAddress("to1@domain.com", "Recipient 1", False))
message.[To].Add(New MailAddress("to2@domain.com", "Recipient 2", False))
message.CC.Add(New MailAddress("cc1@domain.com", "Recipient 3", False))
message.CC.Add(New MailAddress("cc2@domain.com", "Recipient 4", False))
' Save message in EML, EMLX, MSG and MHTML formats
message.Save("CreateNewMailMessage_out.eml", SaveOptions.DefaultEml)
message.Save("CreateNewMailMessage_out.emlx", SaveOptions.CreateSaveOptions(MailMessageSaveType.EmlxFormat))
message.Save("CreateNewMailMessage_out.msg", SaveOptions.DefaultMsgUnicode)
message.Save("CreateNewMailMessage_out.mhtml", SaveOptions.DefaultMhtml)
Constructors
| Name | Description |
|---|---|
| MailMessage (5 overloads) | Initializes a new instance of the MailMessage class |
Methods
| Name | Description |
|---|---|
| AddAlternateView | Add an alternate view to message |
| AddAttachment | Add an attachment to message |
| BuildDeliveryStatusNotificationString | |
| CheckBounced | Checks whether this message can be treated as a bounce message. |
| Clone | Clones this instance |
| CreateContentData | |
| CreateDKIMContentData | |
| CreateReadReceipt | Creates the read receipt. |
| Dispose (2 overloads) | Releases all resources used by the MailMessage |
| Equals | Determines whether the specified Object is equal to the current Object. |
| ForceTextContentType | |
| get_AlternateViews | Gets the collection of alternate views of message |
| get_Attachments | Gets the collection of attachments of message |
| get_Bcc | Gets the address collection that contains the BCC recipients of message |
| get_Body | Gets 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. |
| get_BodyEncoding | Gets encoding of body |
| get_BodyType | Gets the type of the body. |
| get_Categories | Gets exchange message categories |
| get_CC | Gets the address collection that contains the CC recipients |
| get_Date | Gets the date of message |
| get_DeliveryNotificationOptions | Gets the delivery notifications |
| get_Epilogue | Gets an epilogue text. It is located after the last boundary. |
| get_ExtendedProperties | Gets extended properties of a message. |
| get_From | Gets the from address |
| get_Headers | Gets headers collection of message |
| get_HtmlBody | Gets html body |
| get_IsBodyHtml | Gets a value indicating whether the message body is in Html |
| get_IsDraft | Gets value that indicates whether or not a message has been sent. |
| get_IsEmpty | |
| get_IsEncrypted | Gets a value indicating whether the message is encrypted. |
| get_IsRead | |
| get_IsReadOnly | Gets a value indicating whether the message is read only |
| get_IsSigned | Gets a value indicating whether the message is signed. |
| get_ItemId | Represents identification information about message in a mailbox. |
| get_LinkedResources | Gets the collection of linked resources of message |
| get_ListUnsubscribe | The List-Unsubscribe field describes the command (preferably using mail) to directly unsubscribe the user(removing them from the list). For more details please see https://tools.ietf.org/html/rfc2369 |
| get_Message | |
| get_MessageId | Gets the message id |
| get_OriginalIsTnef | Gets a value indicating whether original EML message is in TNEF format. |
| get_Preamble | Gets a preamble text. It is located before the first boundary and generally includes an explanatory note to non-MIME conformant readers. |
| get_PreferredTextEncoding | Gets preferred encoding for all text properties |
| get_PreserveTnefAttachment | Controls TNEF attachment load/save behaviour |
| get_Priority | Gets the priority of message |
| get_ReadReceiptRequested | |
| get_ReadReceiptTo | Gets the read receipt address. |
| get_ReplyToList | Gets the list of addresses to reply to for the mail message |
| get_ReversePath | Gets ReversePath address |
| get_Sender | Gets sender address |
| get_Sensitivity | Gets the sensitivity of message |
| get_Subject | Gets the subject line |
| get_SubjectEncoding | Gets the encoding of subject |
| get_SuppressBcc | Indicates whether Bcc header is suppressed in MIME. |
| get_TimeZoneOffset | Gets the Coordinated Universal Time (UTC) offset for the message dates. This property defines the time zone difference, between the local time and UTC. |
| get_TnefAttachment | Gets the tnef attachment. |
| get_To | Gets the address collection that contains the recipients of message |
| get_VentLicense | This stores the venture licensing state instead of 2 obvious fields such as string value for watermark and some value indicating license is set or not. |
| get_XMailer | Gets the X-Mailer the software that created the e-mail message |
| GetAlternateViewContent | Gets the content as a string from the specified AlternateView . |
| GetEmlStream | |
| GetHashCode | Returns a hash code for object |
| GetHeadersAsString | |
| GetHtmlBodyText (2 overloads) | Gets the message html body as plain text. This method parses the HtmlBody property and returns plain text content ignoring the html markup. |
| GetHtmlView | |
| GetLinkedResourceCount | Gets the count of message linked resources and alternative view linked resourced. |
| GetTextPlainView | |
| Import | Populates a T:System::Runtime::Serialization::SerializationInfo with the data needed to serialize the target object. |
| ImportHeaders (2 overloads) | |
| ListAttachmentBase | |
| Load (4 overloads) | Load message from stream |
| LoadInternal (2 overloads) | Load message from stream. NOTE!!! Call this method if you don’t need to increase customer consumption credit for Dynabic.Metered. |
| LoadMessageStructure | Loads the message structure and search text body and html body parts’ indexes |
| OnConversionProgress | |
| 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. |
| Replace | |
| Save (4 overloads) | Save message as a stream |
| Send | |
| set_Bcc | Sets the address collection that contains the BCC recipients of message |
| set_Body | 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. |
| set_BodyEncoding | Sets encoding of body |
| set_Categories | Sets exchange message categories |
| set_CC | Sets the address collection that contains the CC recipients |
| set_Date | Sets the date of message |
| set_DeliveryNotificationOptions | Sets the delivery notifications |
| set_Epilogue | Sets an epilogue text. It is located after the last boundary. |
| set_From (2 overloads) | Sets the from address |
| set_HtmlBody | Sets html body |
| set_IsBodyHtml | Sets a value indicating whether the message body is in Html |
| set_IsDraft | Sets value that indicates whether or not a message has been sent. |
| set_ItemId | Represents identification information about message in a mailbox. |
| set_ListUnsubscribe | The List-Unsubscribe field describes the command (preferably using mail) to directly unsubscribe the user(removing them from the list). For more details please see https://tools.ietf.org/html/rfc2369 |
| set_MessageId | Sets the message id |
| set_Preamble | Sets a preamble text. It is located before the first boundary and generally includes an explanatory note to non-MIME conformant readers. |
| set_PreferredTextEncoding | Sets preferred encoding for all text properties |
| set_PreserveTnefAttachment | Controls TNEF attachment load/save behaviour |
| set_Priority | Sets the priority of message |
| set_ReadReceiptRequested | |
| set_ReadReceiptTo (2 overloads) | Sets the read receipt address. |
| set_ReplyToList (3 overloads) | |
| set_ReversePath | Sets ReversePath address |
| set_Sender (2 overloads) | Sets sender address |
| set_Sensitivity | Sets the sensitivity of message |
| set_Subject | Sets the subject line |
| set_SubjectEncoding | Sets the encoding of subject |
| set_SuppressBcc | Indicates whether Bcc header is suppressed in MIME. |
| set_TimeZoneOffset | Sets the Coordinated Universal Time (UTC) offset for the message dates. This property defines the time zone difference, between the local time and UTC. |
| set_TnefAttachment | Gets the tnef attachment. |
| set_To (3 overloads) | |
| set_XMailer | Sets the X-Mailer the software that created the e-mail message |
| SetContent | |
| SetHtmlBody (2 overloads) | Sets html body. |
| SetMessageId | |
| SetVentureLicense | All Aspose products should implement this method. It is called by a GroupDocs product to indicate whether GroupDocs itself is licensed or not and specify a custom watermark. When GroupDocs is licensed, this document instance should behave as licensed too even if the Aspose product is not licensed. |
| ToString | Returns a string that represents the current object. |
| TryGetEncodingFromHtmlBody | |
| ValidateMessage (2 overloads) | Validate eml message for corresponding to mime specification. |
| Aspose::Email::Clients::Google::Commands::MessageAPI::V1::GetMessageCommand | |
| Aspose::Email::Clients::Graph::GraphClientV1 | |
| Aspose::Email::Clients::Graph::V1::Commands::CreateMailMessageCommand | |
| Aspose::Email::Clients::Graph::V1::Commands::SendMailMessageCommand | |
| Aspose::Email::Clients::Graph::V1::Commands::UpdateMailMessageCommand | |
| Aspose::Email::Clients::Imap::Commands::FetchMessageGrCommand | |
| Aspose::Email::Clients::Imap::Commands::FetchMessagesGrCommand | |
| Aspose::Email::Mapi::MailMessageInterpretor | |
| Aspose::Email::Mapi::MapiMessage | |
| attachments | |
| body | |
| bodyEncoding | |
| bodyHtml | |
| boundaries | |
| ConversionProgressEvent | Event to notify user about progress of conversion/saving. |
| deliveryStatusNotification | |
| disposed | |
| isBodyHtml | |
| isProcessedByMboxrdStorageWriter | The property is true, if the current message is processed by a MboxrdStorageWriter. See EMAILNET-38895 and EMAILNET-39005 |
| linkedResources | |
| message | |
| views |