PowerTCP Mail for .NET
PopMessage Class
Members  Example  See Also  Send comments on this topic.
Dart.PowerTCP.Mail Namespace : PopMessage Class




Represents a message on a POP server.

Object Model

PopMessage ClassMessageStream Class

Syntax

Visual Basic (Declaration) 
Public Class PopMessage 
   Inherits MessageBase
Visual Basic (Usage)Copy Code
Dim instance As PopMessage
C# 
public class PopMessage : MessageBase 
Managed Extensions for C++ 
public __gc class PopMessage : public MessageBase 
C++/CLI 
public ref class PopMessage : public MessageBase 

Example

The following example demonstrates logging into a POP server and retrieving all messages.
Visual BasicCopy Code
' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Mail"
' at the top of your class.

' Automatically remove files after getting them from the server
Pop1.AutoDelete = True

' Login. The default settings will cause the Pop component to
' automatically retrieve all messages, delete them from the
' server, and logout.
Pop1.Login("mail.test.com", "testuser", "testpass")

' All message retrieved. Iterate through the collection
' and display data.
Dim msg As PopMessage
For Each msg In Pop1.Messages
   Debug.WriteLine("Message ID: " + msg.Id)
   Debug.WriteLine("Message UID: " + msg.Uid)
   Debug.WriteLine("Messge Size: " + msg.Size)
   Debug.WriteLine("From: " + msg.Message.From.Address)
   Debug.WriteLine("Subject: " + msg.Message.Subject)
Next
C#Copy Code
// Be sure to import the namespace by putting "using Dart.PowerTCP.Mail;"
// at the top of your class.

// Automatically remove files after getting them from the server
pop1.AutoDelete = true;

// Login. The default settings will cause the Pop component to
// automatically retrieve all messages, delete them from the
// server, and logout.
pop1.Login("mail.test.com", "testuser", "testpass");

// All message retrieved. Iterate through the collection
// and display data.
foreach(PopMessage msg in pop1.Messages)
{
   Debug.WriteLine("Message ID: " + msg.Id);
   Debug.WriteLine("Message UID: " + msg.Uid);
   Debug.WriteLine("Messge Size: " + msg.Size);
   Debug.WriteLine("From: " + msg.Message.From.Address);
   Debug.WriteLine("Subject: " + msg.Message.Subject);
}

Remarks

A PopMessage object represents a message on a POP server. Messages existing on the POP server are managed through use of the Pop.Messages array, a collection of PopMessage objects. This array can be populated several different ways depending on your needs. The Pop.AutoGet property controls how to get messages. For example, the Pop.AutoGet property defaults to MessageSection.Complete, meaning that the Pop component will automatically get all messages once logged in. If you simply want the header but not the complete messages, set the Pop.AutoGet property to MessageSection.Header. To disable automatic message retrieval (meaning you are going to explicitly "get" a message using the PopMessage.Get method) set Pop.AutoGet to MessageSection.None.

Once you get a message, access the PopMessage.Message property for the MessageStream object encapsulating the message.

PopMessage objects can only be created internally by the Pop component. A PopMessage object cannot be explicitly created by the user.

Inheritance Hierarchy

System.Object
   Dart.PowerTCP.Mail.MessageBase
      Dart.PowerTCP.Mail.PopMessage

Requirements

Target Platforms: Microsoft .NET Framework 2.0

See Also

Documentation Version 3.2
© 2010 Dart Communications. All Rights Reserved.