| MailMessage Class |
Namespace: MailBee.Mime
The MailMessage type exposes the following members.
| Name | Description | |
|---|---|---|
| MailMessage | Initializes a new instance of the MailMessage class |
| Name | Description | |
|---|---|---|
| AppendChunk |
Adds a block of bytes to the source of the message.
| |
| AppendPartialMessage |
Adds the specified partial message to this message.
| |
| Clear |
Removes the specified elements from the message.
| |
| Clone |
Creates a copy of the message.
| |
| ConvertFromSystemNetMail |
Loads the message from System.Net.Mail.MailMessage object.
| |
| ConvertToSystemNetMail |
Exports the message to System.Net.Mail.MailMessage object.
| |
| Deserialize(String) |
Loads a message from the specified .XML file.
| |
| Deserialize(XmlReader) |
Loads a message from XML stream using the specified XmlReader object.
| |
| DeserializeAsync(String) |
async/await version of Deserialize(String).
| |
| DeserializeAsync(XmlReader) |
async/await version of Deserialize(XmlReader).
| |
| Dispose |
Removes the temporary folders and files that are associated with the mail message.
| |
| DomainKeysSign |
Signs the current e-mail message with DKIM and classic DomainKeys signatures.
| |
| DomainKeysVerify |
Verifies DKIM and classic DomainKeys signatures of the current e-mail message.
| |
| DomainKeysVerifyAsync |
async/await version of DomainKeysVerify.
| |
| EncodeAllHeaders |
Encodes all message headers into the specified encoding.
| |
| Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
| Finalize |
Finalizes the instance of MailMessage object.
(Overrides ObjectFinalize.) | |
| ForwardAsAttachment |
Forwards a mail message as attached .EML file.
| |
| GetAllRecipients |
Gets the EmailAddressCollection object containing the e-mail addresses of all message recipients.
| |
| GetEncodedHeaderValue |
Encodes the value of the specified header.
| |
| GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
| GetHtmlAndRelatedFilesInMemory |
Gets HTML body with references to all inline attachments being replaced with user-defined indexed paths.
| |
| GetHtmlAndSaveRelatedFiles |
Extracts the HTML body of the message, saves the attached inline pictures and other related files to disk, and return the modified HTML body.
| |
| GetHtmlAndSaveRelatedFiles(String, VirtualMappingType, MessageFolderBehavior) |
Prepares the HTML body of the message for displaying in a web application: saves all embedded objects to a temporary location,
replaces their Content-ID's with their virtual paths in the temporary location, and returns the modified HTML body as a string.
| |
| GetHtmlAndSaveRelatedFilesAsync |
async/await version of GetHtmlAndSaveRelatedFiles.
| |
| GetHtmlAndSaveRelatedFilesAsync(String, VirtualMappingType, MessageFolderBehavior) |
async/await version of GetHtmlAndSaveRelatedFiles(String, VirtualMappingType, MessageFolderBehavior).
| |
| GetHtmlWithBase64EncodedRelatedFiles |
Gets the HTML body with all related files being embedded directly in the HTML body as base64 chunks.
| |
| GetMessageRawData |
Gets the source of the message as a byte array.
| |
| GetType | Gets the Type of the current instance. (Inherited from Object.) | |
| ImportRelatedFiles |
Adds all the related files (referenced in HTML part of the message) as inline attachments.
| |
| ImportRelatedFilesAsync |
async/await version of ImportRelatedFiles(ImportRelatedFilesOptions).
| |
| IsBodyAvail |
Indicates if the body of the specified format is present in the message.
| |
| LoadBodyText(String, MessageBodyType) |
Loads the contents of the specified file into HTML or plain-text body of the message.
| |
| LoadBodyText(String, MessageBodyType, Encoding, ImportBodyOptions) |
Loads the contents of the specified file or web page into HTML or plain-text body of the message,
also attaching related objects such as inline images if necessary.
| |
| LoadBodyTextAsync(String, MessageBodyType) |
async/await version of LoadBodyText(String, MessageBodyType).
| |
| LoadBodyTextAsync(String, MessageBodyType, Encoding, ImportBodyOptions) |
async/await version of LoadBodyText(String, MessageBodyType, Encoding, ImportBodyOptions).
| |
| LoadMessage(Byte) |
Loads the message from a byte array.
| |
| LoadMessage(Stream) |
Loads the message from a stream.
| |
| LoadMessage(String) |
Loads the message from the specified file.
| |
| LoadMessageAsync(Stream) |
async/await version of LoadMessage(Stream).
| |
| LoadMessageAsync(String) |
async/await version of LoadMessage(String).
| |
| MakePlainBodyFromHtmlBody |
Creates a plain text body from the existing HTML body of the message.
| |
| MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
| Reset |
Resets all the properties of the MailMessage object to the default values.
| |
| SaveHtmlAndRelatedFiles |
Saves the HTML body of the message and all inline pictures and other inline objects to disk.
| |
| SaveHtmlAndRelatedFilesAsync |
async/await version of SaveHtmlAndRelatedFiles(String).
| |
| SaveMessage(Stream) |
Saves a message into the specified stream.
| |
| SaveMessage(String) |
Saves a message into the specified file.
| |
| SaveMessageAsync(Stream) |
async/await version of SaveMessage(Stream).
| |
| SaveMessageAsync(String) |
async/await version of SaveMessage(String).
| |
| Serialize(String) |
Saves the message into the specified .XML file.
| |
| Serialize(XmlWriter) |
Saves the message into XML stream using the specified XmlWriter object.
| |
| SerializeAsync(String) |
async/await version of Serialize(String).
| |
| SerializeAsync(XmlWriter) |
async/await version of Serialize(XmlWriter).
| |
| SetDateFromString |
Sets the date of the message creation as a string.
| |
| SetUniqueMessageID |
Sets a new unique value of Message-ID header and returns it.
| |
| ToString | Returns a string that represents the current object. (Inherited from Object.) |
| Name | Description | |
|---|---|---|
| Attachments |
Gets the AttachmentCollection object containing the attachments of the mail message.
| |
| Bcc |
Gets or sets the list of blind carbon copy (BCC) recipients of the message.
| |
| BodyHtmlText |
Gets or sets the HTML body of the message.
| |
| BodyParts |
Gets all the text bodies of the message.
| |
| BodyPlainText |
Gets or sets the plain-text body of the message.
| |
| Builder |
Gets or sets the options which affect how the mail message is built by MailBee.
| |
| Cc |
Gets or sets the list of carbon copy (CC) recipients of the message.
| |
| Charset |
Gets or sets the name of the charset which was used to compose the message.
| |
| ConfirmRead |
Gets or sets the e-mail address of an entity which should receive the read confirmation message.
| |
| ConfirmReceipt |
Gets or sets the e-mail address of an entity which should receive the delivery confirmation message
(when the message gets into mailbox of the server).
| |
| ContentType |
Gets the content type of the message.
| |
| Date |
Gets or sets the date and the time when the mail message was composed.
| |
| DateReceived |
Gets the date and the time when the message was received by the server.
| |
| DateSent |
Gets or sets the date and the time when the mail message was sent.
| |
| Filename |
Gets the filename of the file this message was loaded from.
| |
| From |
Gets or sets the e-mail address of the message sender.
| |
| HasAttachments |
Indicates if the message has any attachments.
| |
| Headers |
Gets the collection of the message headers.
| |
| Importance |
Gets or sets the importance of the message.
| |
| IndexOnServer |
Gets the index of the mail message stored on the mail server.
| |
| IsEncrypted |
Indicates if the message is encrypted.
| |
| IsEntire |
Indicates if the message was received completely.
| |
| IsSigned |
Indicates if the message has a digital signature.
| |
| LastResult |
Gets the code of the last occurred error.
| |
| MailTransferEncodingHtml |
Gets or sets the transfer encoding of the HTML body of the message.
| |
| MailTransferEncodingPlain |
Gets or sets the transfer encoding of the plain-text body of the message.
| |
| MdnReportType |
Gets or sets report-type value for Message Disposition Notification (MDN) messages.
| |
| Merge |
Gets the MailMerge object which can be used to perform mail merge using the current e-mail message as a template.
| |
| MessageID |
Gets or sets the Message-ID header of the message.
| |
| MimePartTree |
Gets the root MIME part of the message.
| |
| Organization |
Gets or sets the name of organization to which the sender of the message belongs.
| |
| Parser |
Gets or sets the options which affect how the MailMessage object is parsed.
| |
| PartCount |
Gets the number of parts of the composite message which is split into the several smaller mail messages.
| |
| PartIndex |
Gets the index of the current part in the sequence of parts of a composite message.
| |
| Priority |
Gets or sets the priority of the message.
| |
| RawHeader |
Gets the message header section exactly as it is contained in the message.
| |
| References |
Gets or sets the references of the message.
| |
| ReplyTo |
Gets or sets the list of the e-mail addresses where to send a reply to this message.
| |
| ReturnPath |
Gets the value of Return-Path header.
| |
| Sender |
Gets or sets the value of Sender header.
| |
| Sensitivity |
Gets or sets the sensitivity of the message.
| |
| Size |
Gets the size of the message in bytes.
| |
| SizeOnServer |
Gets the actual message size on the mail server.
| |
| Subject |
Gets or sets the subject of the message.
| |
| ThrowExceptions |
Gets or sets whether the MailMessage object will throw exceptions on errors.
| |
| TimeStamps |
Gets the collection of which represents the trace route of the message.
| |
| To |
Gets or sets the e-mail addresses of the primary recipients of the mail message.
| |
| UidOnServer |
Gets Unique-ID (UID) of the message in the mailbox on the server.
| |
| Version |
Gets the current version of MailBee.NET Objects.
| |
| XMailer |
Gets or sets the details about the software which was used to create the message.
|
Moreover MailMessage
using System.Text; using MailBee; using MailBee.Mime; class Sample { static void Main(string[] args) { MailMessage msg = new MailMessage(); // Set the recipient e-mail from string. msg.To.AddFromString("some_user@domain.com"); // Add more recipient e-mail's along with recipient // names and corresponding remarks. msg.To.Add("user1@domain.com", "User 1", "Remark"); msg.To.Add("user2@domain.com", "User 2", ""); // Set the sender e-mail from string. msg.From.Email = "jdoe@domain.com"; // Set the friendly name of the message sender. msg.From.DisplayName = "John Doe"; // Set the subject of the message. msg.Subject = "Hello"; // Set Carbon Copy (CC) recipient e-mail along with // corresponding name and remarks. msg.Cc.Add("user3@domain.com", "User 3", "Remark"); // Set the plain-formatted body of the message. msg.BodyPlainText = "Hello, World!"; // Set the HTML-formatted body of the message. msg.BodyHtmlText = @"Hello, <b>World</b>!<br> <IMG alt="""" hspace=0 src=""cid:12345"" align=baseline border=0><br> <IMG alt="""" hspace=0 src=""cid:67891"" align=baseline border=0>"; // Specify the charset of the message. msg.Charset = "utf-8"; // Set the Quoted-Printable encoding for plain-formatted body. msg.MailTransferEncodingPlain = MailTransferEncoding.QuotedPrintable; // Set the Quoted-Printable encoding for HTML-formatted body. msg.MailTransferEncodingHtml = MailTransferEncoding.QuotedPrintable; // Add three different attachments to the message. msg.Attachments.Add(@"C:\Docs\new.gif", "1.gif", "12345"); msg.Attachments.Add(@"C:\Docs\old.gif", "2.gif", "67891"); msg.Attachments.Add(@"C:\Docs\2.jpg", "2.jpg"); // Encode all message headers into Base64 encoding. msg.EncodeAllHeaders(Encoding.Default, HeaderEncodingOptions.Base64); // Set the unique message identifier. msg.SetUniqueMessageID(""); // Save message to the disk as .eml file. msg.SaveMessage(@"C:\Temp\TestMail.eml"); // Serialize message into .xml file on the disk. msg.Serialize(@"C:\Temp\TestMail.xml"); } }