Model
Due to the complexity of the MIME format, the GemBox.Email component provides a simple email message model in one class, MailMessage. The following image shows references between MailMessage and other classes that are a part of this simple model.
The MailMessage class can be used on its own to create, save, or load an email message from or to a file or a stream. It is also used by PopClient and ImapClient classes for receiving, and SmtpClient for sending email messages. The following sections explain three major parts of MailMessage:
Model Properties
All mandatory and most used MIME headers (Date, From, To, Sender, Message-ID) are exposed as properties in the MailMessage class. The properties provide parsed and strongly typed header values. All of these properties are synchronized with their respective headers, so any change of a property value will update the underlying header body and vice versa, even properties like 'To' and 'From', which return MailAddress and MailAddressCollection instances.
Body
The MailMessage class provides two properties for message text. One is for plain text (BodyText) and the other is for HTML (BodyHtml). When adding a body to a message, general advice is to add both versions, but a message with only one is valid as well. A HTML body is passed as a value and it will not be validated, so be sure to check it before setting the value.
Attachments
The MIME standard allows extra content, like pictures or documents, to be transmitted with a message. This extra content has to be added to the Attachments property. An attachment can easily be created from any file or stream, by calling the appropriate Attachment constructor. The data provided is copied to memory so you don't have to worry about source files when the message is being sent or saved.