DeleteMessage Method  
 

Delete the specified message from the mail server.

Syntax

object.DeleteMessage( [MessageNumber] )

Parameters

MessageNumber
An optional integer value which specifies the message to delete. If this parameter is omitted, the value of the MessageIndex property will be used.

Return Value

A value of zero is returned if the method succeeds. Otherwise, a non-zero error code is returned which indicates the cause of the failure.

Remarks

The DeleteMessage method marks the specified message for deletion. If the optional message number is not specified, then the current message is deleted. Once a message has been marked as deleted, any attempt to access it will result in an error.

The message will not actually be removed from the server until the Disconnect method is called or the control is unloaded. To prevent messages which have been marked for deletion from actually being removed from the mailbox, call the Reset method.

See Also

MessageIndex Property, Disconnect Method, GetHeader Method, GetMessage Method, Reset Method