| Visual Basic (Declaration) | |
|---|---|
Public Sub Logout() | |
| Visual Basic (Usage) | Copy Code |
|---|---|
Dim instance As Pop instance.Logout() | |
| C# | |
|---|---|
public void Logout() | |
| Managed Extensions for C++ | |
|---|---|
public: void Logout(); | |
| C++/CLI | |
|---|---|
public: void Logout(); | |
| Exception | Description |
|---|---|
| Dart.PowerTCP.Mail.ProtocolException | Bad POP protocol response received from server. |
| System.Net.Sockets.SocketException | The requested address is not valid in its context. |
| System.IO.IOException | The filename, directory name, or volume label syntax is incorrect. |
| System.ArgumentException | A required argument contains invalid characters, is empty, or contains only white spaces. |
| Visual Basic | Copy 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(); | |
This method causes a "QUIT" command to be issued to the server and waits until the server has closed the connection. If Pop.AutoLogout is true, logout will occur automatically. If any messages were marked for deletion, these deletes will occur after calling this method. To perform this operation asynchronously, use the Pop.BeginLogout method.
This method should be considered the intended means of ending an POP session. Pop.Logout differs from the Pop.Dispose method in that the Pop.Dispose method is used to abruptly close the connection and release all resources associated with the Pop component, while Pop.Logout closes the connection gracefully and does not release any resources associated with the Pop component.
Target Platforms: Microsoft .NET Framework 2.0