DeleteMessage Method
Marks specified message for deletion.
It is not required to retrieve message or
its headers prior to deleting. You can start deleting messages as soon as you
have connected to POP3 server. However, you must gracefully disconnect. When you call DeleteMessage, the POP3 server remembers that you
want to delete a message. The message actually gets deleted upon QUIT command which is sent by Disconnect
method. If the connection was aborted for some reason, this won't occur and marking for deletion will be discarded.
Note that in Gmail you may not see any effect of messages deletion via POP3. Go to Gmail POP settings to configure this.
blnResult = ObjectName.DeleteMessage(Index) |
Parameters: | ||
Index As Long | Index of the message to be deleted.
Allowed range is: 1 <= Index <= POP3.MessageCount |
|
Return value As Boolean | True if successful, False if error occurred (Index is out of range, connection failure, etc.) | |
Remarks: | This method just marks the message for deletion. Messages will be deleted later, after calling Disconnect method (this is peculiarity of POP3 protocol). That's why marking the message for deletion does not decrement MessageCount property. |
Usage example:
Dim Mailer 'Using visual basic to create object Set Mailer = CreateObject("MailBee.POP3") 'Using ASP to create object 'Set Mailer = Server.CreateObject("MailBee.POP3") 'In ASP use Response.Write instead of MsgBox Mailer.LicenseKey = "put your license key here" Mailer.Connect "mailserver.com", 110, "MyName", "MyPassword" If Mailer.Connected Then If Mailer.MessageCount > 0 Then Mailer.DeleteMessage 1 End If Mailer.Disconnect End If
See Also:
MessageCount Property
Disconnect Method
Copyright © 2002-2024, AfterLogic Corporation. All rights reserved.