Zip Component, Email Component, Encryption Component ActiveX Control for Zip Compression .NET Components for ASP.NET
ActiveX and .NET Components for Zip Compression, Encryption, Email, XML, S/MIME, HTML Email, Character Encoding, Digital Certificates, FTP, and more ASP Email ActiveX Component

Index of Chilkat Blog Posts

October 20, 2005

VBScript/ASP example to delete only bounced email

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 = ""
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 types documented at
	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
MsgBox "Finished!"

For WebMail2, you need to use this CreateObject statement:
set MyInstance = Server.CreateObject("ChilkatWebMail2.WebMailMan2″)
and instead of calling ExamineMail, call ExamineWebMail.

Privacy Statement. Copyright 2000-2011 Chilkat Software, Inc. All rights reserved.
Send feedback to

Components for Microsoft Windows XP, 2000, 2003 Server, Vista, Windows 7, and Windows 95/98/NT4.