PowerTCP Mail for .NET
Messages Property
See Also  Send comments on this topic.
Dart.PowerTCP.Mail Namespace > Pop Class : Messages Property




An array of PopMessage objects used to manipulate messages.

Syntax

Visual Basic (Declaration) 
<BrowsableAttribute(False)>
Public ReadOnly Property Messages As PopMessage()
Visual Basic (Usage)Copy Code
Dim instance As Pop
Dim value() As PopMessage
 
value = instance.Messages
C# 
[BrowsableAttribute(false)]
public PopMessage[] Messages {get;}
Managed Extensions for C++ 
[BrowsableAttribute(false)]
public: __property PopMessage*[]* get_Messages();
C++/CLI 
[BrowsableAttribute(false)]
public:
property array<PopMessage^>^ Messages {
   array<PopMessage^>^ get();
}

Property Value

An array of PopMessage objects, representing the messages on the server.

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

Messages existing on the POP server are managed through use of the Pop.Messages array. 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.

The PopMessage array will only be populated when the POP server is in the "transaction" state, which occurs after authentication and before logging out. All other times the size of this array will be 0. This collection is 0-based, although POP servers will assign an ID that is 1-based. This means that after login, the POP message with ID "1" can be found at Pop.Messages[0], ID "2" at Pop.Messages[1], etc.

Requirements

Target Platforms: Microsoft .NET Framework 2.0

See Also

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