DataFlex
DataFlex
Delete All Email in a POP3 Mailbox
Delete all email in a POP3 mailbox.Chilkat DataFlex Downloads
Use ChilkatAx-win32.pkg
Procedure Test
Boolean iSuccess
Handle hoMailman
Variant vStUidls
Handle hoStUidls
String sTemp1
Move False To iSuccess
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
// The mailman object is used for receiving (POP3)
// and sending (SMTP) email.
Get Create (RefClass(cComChilkatMailMan)) To hoMailman
If (Not(IsComObjectCreated(hoMailman))) Begin
Send CreateComObject of hoMailman
End
// Set the POP3 server's hostname
Set ComMailHost Of hoMailman To "pop.example.com"
// Set the POP3 login/password.
Set ComPopUsername Of hoMailman To "bob@example.com"
Set ComPopPassword Of hoMailman To "****"
// Make sure the ImmediateDelete property is set (this is the default)
// If ImmediateDelete is not set, messages marked for deletion
// by the Delete* methods will not be deleted until the POP3
// connection is closed by calling Pop3EndSession.
Set ComImmediateDelete Of hoMailman To True
// First, get all the UIDLs.
Get Create (RefClass(cComChilkatStringTable)) To hoStUidls
If (Not(IsComObjectCreated(hoStUidls))) Begin
Send CreateComObject of hoStUidls
End
Get pvComObject of hoStUidls to vStUidls
Get ComFetchUidls Of hoMailman vStUidls To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoMailman To sTemp1
Showln sTemp1
Procedure_Return
End
// Next, delete them all.
Get pvComObject of hoStUidls to vStUidls
Get ComDeleteUidlSet Of hoMailman vStUidls To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoMailman To sTemp1
Showln sTemp1
Procedure_Return
End
// We're done with the POP3 session, so it doesn't hurt to call this...
Get ComPop3EndSession Of hoMailman To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoMailman To sTemp1
Showln sTemp1
Procedure_Return
End
Showln "Success."
End_Procedure