Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
|
Convert Web Page to HTML Email and Send
This FoxPro sample code downloads and converts a web page to HTML mail and sends it. ***********************************************************
*** Chilkat MHT: FoxPro to convert a web page into HTML email and send it.
*** NOTE: This example requires licenses to both Chilkat Mail and Chilkat MHT.
***********************************************************
LOCAL loMailMan, loEmail, lnSuccess
********************************************************************
*!* object loMailman (ChilkatMailMan) manages pop3 / smtp configuration
*!* and sending and receiving email
********************************************************************
*!* object loEMail (ChilkatEmail) represents an email
********************************************************************
*!* object loMht (ChilkatMht) converts a web page into an email object.
********************************************************************
loMht = CreateObject('Chilkat.Mht')
loMht.UnlockComponent('mhtUnlockCode') && Unlocks the mht object
loMailman = CreateObject('Chilkat.MailMan2')
loMailman.UnlockComponent('mailUnlockCode') && Unlocks the mailman object
*The hostname of the SMTP server used to send email
loMailman.SmtpHost = 'smtp.earthlink.net'
****************************
*!* create the email
****************************
loEmail = loMht.GetEmail("http://www.google.com")
loEmail.AddTo ( "Chilkat Support", "support@chilkatsoft.com") && Adds a recipient to the "to" list
loEmail.Subject = "This is the Google home page" && The subject of the email
loEmail.FromName = 'Matt'
loEmail.FromAddress = "matt@chilkatsoft.com"
*Send an email. If mail was not successfully sent to any recipients, then an error is raised
lnSuccess = loMailman.SendEmail(loEmail)
*!* Nobody got the email: Function returns 0 and error is raised.
*!* Everybody got the email: Function returns 1.
*!* Some, but not everyone, got the email: Function returns 0, but error is not raised.
IF ( lnSuccess = 1 )
=MESSAGEBOX('The mail was sent succesfully',0+64,'Chilkat send email')
ENDIF
******************************************************************************
* Releasing objects
******************************************************************************
RELEASE loMailman, loEmail, loMht
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