Tcl
Tcl
Send a POP3 RSET to Unmark Deletions
See more POP3 Examples
Demonstrates the Chilkat MailMan.Pop3Reset method, which sends the POP3 RSET command to the server. Any messages marked for deletion during the current session are unmarked and remain in the mailbox, and the POP3 session stays open. This example marks a message for deletion, then clears the mark with RSET.
Background:
RSET is POP3's in-session undo for deletion marks. It differs from Pop3EndSessionNoQuit, which also discards pending deletions but closes the connection. With RSET the authenticated session continues, so you can clear the marks and keep working — handy when a processing step fails partway and you want to retry without reconnecting.Chilkat Tcl Downloads
load ./chilkat.dll
set success 0
# Demonstrates the MailMan.Pop3Reset method, which sends the POP3 RSET command. Any
# messages marked for deletion during the current session are unmarked and remain in the
# mailbox. The POP3 session stays open.
set mailman [new_CkMailMan]
# Configure the POP3 server connection.
CkMailMan_put_MailHost $mailman "pop.example.com"
CkMailMan_put_MailPort $mailman 995
CkMailMan_put_PopSsl $mailman 1
CkMailMan_put_PopUsername $mailman "user@example.com"
CkMailMan_put_PopPassword $mailman "myPassword"
set success [CkMailMan_Pop3BeginSession $mailman]
if {$success == 0} then {
puts [CkMailMan_lastErrorText $mailman]
delete_CkMailMan $mailman
exit
}
# Mark a message for deletion...
set success [CkMailMan_DeleteByMsgnum $mailman 1]
if {$success == 0} then {
puts [CkMailMan_lastErrorText $mailman]
delete_CkMailMan $mailman
exit
}
# ...then change your mind: RSET unmarks all pending deletions but keeps the session open.
set success [CkMailMan_Pop3Reset $mailman]
if {$success == 0} then {
puts [CkMailMan_lastErrorText $mailman]
delete_CkMailMan $mailman
exit
}
# Ending the session now commits nothing, because the marks were cleared.
set success [CkMailMan_Pop3EndSession $mailman]
if {$success == 0} then {
puts [CkMailMan_lastErrorText $mailman]
delete_CkMailMan $mailman
exit
}
puts "Pending deletions were unmarked with RSET."
delete_CkMailMan $mailman