PowerTCP Mail for .NET
Get() Method
See Also  Example Send comments on this topic.
Dart.PowerTCP.Mail Namespace > PopMessage Class > Get Method : Get() Method




Get a single message from the server. The message will be encapsulated by a MessageStream.

Syntax

Visual Basic (Declaration) 
Public Overloads Function Get() As PopMessage
Visual Basic (Usage)Copy Code
Dim instance As PopMessage
Dim value As PopMessage
 
value = instance.Get()
C# 
public PopMessage Get()
Managed Extensions for C++ 
public: PopMessage* Get(); 
C++/CLI 
public:
PopMessage^ Get(); 

Return Value

A PopMessage object, representing the message retrieved.

Example

The following example demonstrates retrieving a single POP message.
Visual BasicCopy Code
' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Mail"
' at the top of your class.

' This example demonstrates getting a single message. To do
' this, you must login and keep the connection. Set AutoLogout
' to false to disable auto logout.
Pop1.AutoLogout = False

' Do not automatically get any part of the message.
Pop1.AutoGet = MessageSection.None

' Login
Pop1.Login("mail.test.com", "testuser", "testpass")

' Check to see if any messages were retrieved.
If Pop1.Messages.Length > 0 Then

   ' Get the first message.
   Pop1.Messages(0).Get()

   ' Display data about this message.
   Debug.WriteLine("From: " + Pop1.Messages(0).Message.From.Address)
   Debug.WriteLine("Subject: " + Pop1.Messages(0).Message.Subject)
End If

' Logout has to be explicitly done since AutoLogout = false
Pop1.Logout()
C#Copy Code
// Be sure to import the namespace by putting "using Dart.PowerTCP.Mail;"
// at the top of your class.

// This example demonstrates getting a single message. To do
// this, you must login and keep the connection. Set AutoLogout
// to false to disable auto logout.
pop1.AutoLogout = false;

// Do not automatically get any part of the message.
pop1.AutoGet = MessageSection.None;

// Login
pop1.Login("mail.test.com", "testuser", "testpass");

// Check to see if any messages were retrieved.
if(pop1.Messages.Length > 0)
{
   // Get the first message.
   pop1.Messages[0].Get();

   // Display data about this message.
   Debug.WriteLine("From: " + pop1.Messages[0].Message.From.Address);
   Debug.WriteLine("Subject: " + pop1.Messages[0].Message.Subject);
}

// Logout has to be explicitly done since AutoLogout = false
pop1.Logout();

Remarks

This method gets a single message from the server. Upon successful completion, the PopMessage.Message property will contain a MessageStream object representing the message. The MessageStream object provides flexibility and functionality in accessing the message. For example, message header lines, message text, and message attachments are all available as collections of the MessageStream object. The MessageStream object also provides decoding of MIME parts "on the fly".

This overload of PopMessage.Get is the suggested way to get a single message.

To perform this operation asynchronously, use the PopMessage.BeginGet method.

Requirements

Target Platforms: Microsoft .NET Framework 2.0

See Also

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