OpenPop.NET POP3 Library Documentation

Message Methods

The methods of the Message class are listed below. For a complete list of Message class members, see the Message Members topic.

Public Static Methods

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

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