Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ Delphi FoxPro Java Perl Python Ruby SQL Server VBScript
|
POP3 to SMTP ForwarderRead a POP3 mailbox and forwards the email to another email address, keeping the recipients in the original email the same.
LOCAL loMailman LOCAL lnSuccess LOCAL loSaUidls LOCAL loSaMime LOCAL i LOCAL lcStrMime LOCAL n LOCAL lcFromAddr LOCAL lcToAddr LOCAL lnBAllOk * The mailman object is used for receiving (POP3) * and sending (SMTP) email. loMailman = CreateObject('Chilkat.MailMan2') * Any string argument automatically begins the 30-day trial. lnSuccess = loMailman.UnlockComponent("30-day trial") IF (lnSuccess <> 1) THEN =MESSAGEBOX("Component unlock failed") QUIT ENDIF * Set the POP3 server's hostname loMailman.MailHost = "mail.chilkatsoft.com" * Set the POP3 login/password. loMailman.PopUsername = "matt@chilkatsoft.com" loMailman.PopPassword = "****" * The the UIDLs for all email in the POP3 mailbox. loSaUidls = loMailman.GetUidls() IF (loSaUidls = NULL ) THEN =MESSAGEBOX(loMailman.LastErrorText) QUIT ENDIF * Download the email from the server. Call FetchMultipleMime * because we don't want to load the emails into email objects. * (We'll delete the emails that are forwarded without error.) loSaMime = loMailman.FetchMultipleMime(loSaUidls) IF (loSaMime = NULL ) THEN RELEASE loSaUidls =MESSAGEBOX(loMailman.LastErrorText) QUIT ENDIF * Set the SMTP hostname for sending. loMailman.SmtpHost = "mail.chilkatsoft.com" loMailman.SmtpUsername = "admin@chilkatsoft.com" loMailman.SmtpPassword = "****" n = loSaMime.Count lcFromAddr = "matt@chilkatsoft.com" lcToAddr = "admin@chilkatsoft.com" lnBAllOk = 1 IF (n > 0) THEN FOR i = 0 TO n - 1 lcStrMime = loSaMime.GetString(i) * Forward the email. lnSuccess = loMailman.SendMime(lcFromAddr,lcToAddr,lcStrMime) IF (lnSuccess <> 1) THEN lnBAllOk = 0 ? loMailman.LastErrorText EXIT ENDIF NEXT ENDIF * Remove the emails in saUidls from the POP3 server. IF (lnBAllOk = 1) THEN lnSuccess = loMailman.DeleteMultiple(loSaUidls) IF (lnSuccess <> 1) THEN ? loMailman.LastErrorText ENDIF ENDIF RELEASE loSaMime RELEASE loSaUidls |
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