Message Members

OpenPop.NET

OpenPop.NET POP3 Library Documentation

Message Members

Message overview

Public Static Methods

LoadOverloaded. Loads a Message from a file containing a raw email.

Public Instance Constructors

Message Overloaded. Initializes a new instance of the Message class.

Public Instance Properties

Headers Headers of the Message.
MessagePart This is the body of the email Message.

If the body was parsed for this Message, this property will never be a null reference.
RawMessage The raw content from which this message has been constructed.
These bytes can be persisted and later used to recreate the Message.

Public Instance Methods

FindAllAttachments Finds all the MessagePart's which are attachments to this message.

IsAttachment for MessageParts which are considered to be attachments.
FindAllMessagePartsWithMediaType Finds all the MessageParts in the Message hierarchy with the given MediaType.
FindAllTextVersions Finds all the MessagePart's which contains a text version.

IsText for MessageParts which are considered to be text versions.

Examples of MessageParts media types are:
  • text/plain
  • text/html
  • text/xml
FindFirstHtmlVersion Finds the first text/html MessagePart in this message.
This is a convenience method - it simply propagates the call to FindFirstMessagePartWithMediaType.

If no text/html version is found, a null reference is returned.
FindFirstMessagePartWithMediaType Finds the first MessagePart in the Message hierarchy with the given MediaType.

The search in the hierarchy is a depth-first traversal.
FindFirstPlainTextVersion Finds the first text/plain MessagePart in this message.
This is a convenience method - it simply propagates the call to FindFirstMessagePartWithMediaType.

If no text/plain version is found, a null reference is returned.
SaveOverloaded. Save this Message to a file.

Can be loaded at a later time using the Load method.
ToMailMessage This method will convert this Message into a MailMessage equivalent.
The returned MailMessage can be used with SmtpClient to forward the email.

You should be aware of the following about this method:
  • All sender and receiver mail addresses are set. If you send this email using a SmtpClient then all receivers in To, From, Cc and Bcc will receive the email once again.
  • If you view the source code of this Message and looks at the source code of the forwarded MailMessage returned by this method, you will notice that the source codes are not the same. The content that is presented by a mail client reading the forwarded MailMessage should be the same as the original, though.
  • Content-Disposition headers will not be copied to the MailMessage. It is simply not possible to set these on Attachments.
  • HTML content will be treated as the preferred view for the Body. Plain text content will be used for the Body when HTML is not available.

See Also

Message Class | OpenPop.Mime Namespace