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




Controls automatic log out after all communication with the POP server is complete.

Syntax

Visual Basic (Declaration) 
<DefaultValueAttribute()>
<CategoryAttribute("Behavior")>
<DescriptionAttribute("When true, the session is gracefully closed before returning from the Login() method.")>
Public Property AutoLogout As Boolean
Visual Basic (Usage)Copy Code
Dim instance As Pop
Dim value As Boolean
 
instance.AutoLogout = value
 
value = instance.AutoLogout
C# 
[DefaultValueAttribute()]
[CategoryAttribute("Behavior")]
[DescriptionAttribute("When true, the session is gracefully closed before returning from the Login() method.")]
public bool AutoLogout {get; set;}
Managed Extensions for C++ 
[DefaultValueAttribute()]
[CategoryAttribute("Behavior")]
[DescriptionAttribute("When true, the session is gracefully closed before returning from the Login() method.")]
public: __property bool get_AutoLogout();
public: __property void set_AutoLogout( 
   bool value
);
C++/CLI 
[DefaultValueAttribute()]
[CategoryAttribute("Behavior")]
[DescriptionAttribute("When true, the session is gracefully closed before returning from the Login() method.")]
public:
property bool AutoLogout {
   bool get();
   void set (    bool value);
}

Property Value

true if the Pop control should automatically logout after the Pop.Messages property is populated; false otherwise. The default value is true.

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

After log in, the Pop.Messages property will be populated with PopMessage objects created for each messages in the mail drop. If Pop.AutoLogout is true, the session will then be closed. If Pop.AutoLogout is false, the session will remain open, enabling further communication with the server. In this case, the Pop.Logout method should be used when communication is complete, explicitly ending the session.

Usually communication with POP servers is simple, and do not require prolonged sessions with multiple requests. However, if this is not the case, set this property to false and the POP session will remain open after all messages are retrieved, allowing further commands to be sent.

Requirements

Target Platforms: Microsoft .NET Framework 2.0

See Also

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