• Loading...
UltimateMail
Delete Method
See Also  Example Send comments on this topic to ATP, Inc.
Atp.Net.Mail Namespace > Pop3Client Class : Delete Method




sequenceNumber
The sequence number of the message to delete.
Flags the specified message for deletion from the server.

Syntax

Visual Basic (Declaration) 
Public Sub Delete( _
   ByVal sequenceNumber As Integer _
) 
Visual Basic (Usage)Copy Code
Dim instance As Pop3Client
Dim sequenceNumber As Integer
 
instance.Delete(sequenceNumber)
C# 
public void Delete( 
   int sequenceNumber
)
Managed Extensions for C++ 
public: void Delete( 
   int sequenceNumber
) 
C++/CLI 
public:
void Delete( 
   int sequenceNumber
) 

Parameters

sequenceNumber
The sequence number of the message to delete.

Example

C#Copy Code
using Atp.Net;
using Atp.Net.Mail;

namespace Samples.Pop3
{
   
class DeleteMessage
   {
       
static void Main()
       {
           
// POP3 server information.
           
const string serverName = "myserver";
           
const string user = "name@domain.com";
           
const string password = "mytestpassword";
           
const int port = 995;
           
const SecurityMode securityMode = SecurityMode.Implicit;

           
// Create a new instance of the Pop3Client class.
           
Pop3Client client = new Pop3Client();

           
// Connect to the server.
           
client.Connect(serverName, port, securityMode);

           
// Login to the server.
           
client.Authenticate(user, password);

           
// Delete a mail message with sequence number 1.
           
client.Delete(1);

           
// Close the connection.
           
client.Disconnect();
       }
   }
}
Visual BasicCopy Code
Imports Atp.Net
Imports Atp.Net.Mail

Module Pop3DeleteMessage
    Sub Main()
        ' POP3 server information.
        Const serverName As String = "myserver"
        Const user As String = "name@domain.com"
        Const password As String = "mytestpassword"
        Const port As Integer = 995
        Const securityMode As SecurityMode = securityMode.Implicit

        ' Create a new instance of the Pop3Client class.
        Dim client As New Pop3Client()

        ' Connect to the server.
        client.Connect(serverName, port, securityMode)

        ' Login to the server.
        client.Authenticate(user, password)

        ' Delete a mail message with sequence number 1.
        client.Delete(1)

        ' Close the connection.
        client.Disconnect()
    End Sub
End Module

Remarks

If the POP3 server supports pipelining, this method will flag all the messages in the specified range in a single network operation, which greatly increases performance and reduces network traffic.

Messages flagged for deletion are actually removed from the server on Disconnect method call. Until this moment, you can remove the deletion status for all messages flagged as deleted by calling Undelete method.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

ATP, Inc. is a Microsoft Partner. Our components are compatible with Windows 7 and optimized for Visual Studio