Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
|
Delete POP3 Email in Visual FoxPro
This Visual FoxPro source code example shows how to delete POP3 mail. ***********************************************************
*** Visual FoxPro to Delete Mail from a POP3 Server
***********************************************************
LOCAL loMailMan, loEmail, loBundle, lnSuccess, lcSummary
****************************
*!* configure POP3 options
****************************
loMailman = CreateObject('Chilkat.MailMan2')
loMailman.UnlockComponent('unlock_code')
loMailman.MailHost = 'mail.chilkatsoft.com'
loMailman.PopUsername = 'matt'
loMailman.PopPassword = 'myPassword'
* Read Email from the POP3 Server
* CopyMail copies it from the POP3 server (leaving it there)
* while TransferMail moves it off the POP3 server.
loBundle = loMailman.CopyMail()
* Loop over the emails in the bundle, save each as XML,
* display each, and delete from the POP3 server.
* We could have removed all the emails from the
* POP3 server by calling Transfer mail, but this demonstrates
* how to selectively delete an email after it has
* been downloaded.
FOR i = 0 TO loBundle.MessageCount-1
loEmail = loBundle.GetEmail(i)
=loEmail.SaveXml("email" + LTRIM(STR(i)) + ".xml")
lcSummary = "From: " + loEmail.From + CHR(13)+CHR(10)
lcSummary = lcSummary + "Subject: " + loEmail.Subject + CHR(13)+CHR(10)
lcSummary = lcSummary + "Date: " + DTOS(loEmail.LocalDate) + CHR(13)+CHR(10)
lcSummary = lcSummary + "Attachments: " + STR(loEmail.NumAttachments) + CHR(13)+CHR(10)
lcSummary = lcSummary + "Body: " + loEmail.Body
=MESSAGEBOX(lcSummary)
* If the email has no attachments, delete it from the POP3 server.
IF loEmail.NumAttachments = 0 then
* Our local object is still useable, but the email has been removed from the server.
=loMailman.DeleteEmail(loEmail)
ENDIF
RELEASE loEmail
NEXT
RELEASE loMailman, loBundle
RETURN .T.
******************************************************************************
|
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2007 Chilkat Software, Inc. All Rights Reserved.
Mail Component · .NET Email Component · ASP Mail Component · XML Parser