Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
|
Download Email and Forward
Download email from a POP3 server into a collection of MIME strings (each email is a MIME string) and forward to another recipient. The MIME is never parsed by Chilkat. ' Read email from a POP3 server and return the complete MIME source of each email.
' The emails downloaded from the POP3 server are not loaded into Chilkat.Email objects,
' therefore they are not parsed, unwrapped (for encrypted/signed email), or modified
' in any way.
Dim mailman As New Chilkat.MailMan
mailman.UnlockComponent("anything for 30-day trial")
mailman.MailHost = "mail.chilkatsoft.com"
mailman.PopUsername = "****"
mailman.PopPassword = "****"
' We'll need the SMTP hostname and (optionally) the login
' to send email...
mailman.SmtpHost = "smtp.chilkatsoft.com"
mailman.SmtpUsername = "****"
mailman.SmtpPassword = "****"
' Get the UIDLs of all the mail messages on the POP3 server.
Dim allUidls As Chilkat.StringArray
allUidls = mailman.GetUidls()
' mimeArr is an object containing collection of strings
Dim mimeArr As Chilkat.StringArray
' Download the entire mailbox.
' Call FetchMultipleMime to leave the email on the server.
' Call TransferMultipleMime to download and remove from the server.
mimeArr = mailman.TransferMultipleMime(allUidls)
'mimeArr = mailman.FetchMultipleMime(allUidls)
' Show how many emails were downloaded.
MessageBox.Show(mimeArr.Count)
' Forward each email to another recipient.
Dim i As Integer
Dim success As Boolean
For i = 0 To mimeArr.Count
success = mailman.SendMime("matt@chilkatsoft.com", "somebody-else@chilkatsoft.com", mimeArr.GetString(i))
If (Not success) Then
MessageBox.Show(mailman.LastErrorText)
' ... do whatever else you want...
End If
Next
|
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2007 Chilkat Software, Inc. All Rights Reserved.