A customer requested an example to delete only bounced emails from a POP3 server, so here it is:
(for ASP, use Server.CreateObject)
<font size=2 face=courier>
set mailman = CreateObject("ChilkatMail2.ChilkatMailMan2″)
mailman.UnlockComponent "30-day trial"
mailman.MailHost = "mail.chilkatsoft.com"
mailman.PopUsername = "mylogin"
mailman.PopPassword = "mypassword"
set bounce = CreateObject("ChilkatBounce.ChilkatBounce")
bounce.UnlockComponent "30-day trial"
‘ Read the email, but do not delete anything
set bundle = mailman.CopyMail()
numEmails = bundle.MessageCount
for i = 0 to numEmails-1
set email = bundle.GetEmail(i)
‘ Check to see if it is a bounced email.
bounce.ExamineMail(email)
‘ Bounce types documented at http://www.chilkatsoft.com/refdoc/xChilkatBounceRef.html
if (bounce.BounceType <> 0) then
‘ Display the bounced email’ subject,
‘ and then delete the mail from the POP3 server.
MsgBox email.Subject
mailman.DeleteEmail email
end if
next
MsgBox "Finished!"
</font>
For WebMail2, you need to use this CreateObject statement:
set MyInstance = Server.CreateObject("ChilkatWebMail2.WebMailMan2″)
and instead of calling ExamineMail, call ExamineWebMail.