MailBee.NET Objects 6.0

Pop3.DeleteMessages Method ()

Flags all the messages in the inbox for deletion from the server.

public bool DeleteMessages();

Return Value

true if the messages have been flagged for deletion or the inbox is empty; otherwise, false.

Remarks

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

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

Exceptions

Exception Type Condition
MailBeeException An error occurred and ThrowExceptions is true.

Example

This sample deletes all the messages in the inbox.

[C#]
// To use the code below, import MailBee namespaces at the top of your code.
using MailBee;
using MailBee.Pop3Mail;

// The actual code (put it into a method of your class).
Pop3 pop = new Pop3();
pop.Connect("mail.domain.com");
pop.Login("jdoe", "secret");
pop.DeleteMessages();
pop.Disconnect();
[Visual Basic]
' To use the code below, import MailBee namespaces at the top of your code.
Imports MailBee
Imports MailBee.Pop3Mail

' The actual code (put it into a method of your class).
Dim pop As New Pop3
pop.Connect("mail.domain.com")
pop.Login("jdoe", "secret")
pop.DeleteMessages()
pop.Disconnect()

See Also

Pop3 Class | MailBee.Pop3Mail Namespace | Pop3.DeleteMessages Overload List