Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
|
Send Email with Progress Monitoring
Visual FoxPro program to send email with progress monitoring. *
*The IMPLEMENTS... in the class "Ctrl" below is what makes Foxpro take control over the
*SendPercentDone, ReadPercentDone and AbortCheck
*Long as you have DOEVENTS in it VFP keeps process events, although not as fast as normal.
*So while you download / send large Email you can keep using your program.
*NOTE - This path part of the IMPLEMENTS must point to the dll, so locate and correct it before you are using the program.
***********************************************************
*** Chilkat SMTP: Send a single email without attachments
***********************************************************
LOCAL loMailMan, loEmail, lnSuccess
********************************************************************
*!* object loMailman (ChilkatMailMan) manages pop3 / smtp configuration
*!* and sending and receiving email
********************************************************************
*!* object loEMail (ChilkatEmail) represents an email
********************************************************************
****************************
*!* configure smtp options
****************************
oCtrl = CREATEOBJECT("Ctrl") && Create controlling object:
loMailman = CreateObject('Chilkat.MailMan2')
loMailman.UnlockComponent('unlock_code') && Unlocks the mailman object
*The EVENTHANDLER tells the COM object to send its calls to VFP.
*Bind the Chilkat COM server events to the VFP object:
EVENTHANDLER(loMailman,oCtrl)
*The hostname of the SMTP server used to send email
*loMailman.SmtpHost = 'mail.earthlink.net'
*The login for logging into the SMTP server. Use this only if your SMTP server requires authentication
*loMailman.SmtpUsername = 'my_username'
*default: 25 -> The port number of the SMTP server used to send email.
*Only needs to be set if the SMTP server is running on a non-standard port
*loMailman.SmtpPort = 25
****************************
*!* create the email
****************************
loEmail = CreateObject("Chilkat.Email2")
loEmail.AddTo ( "Chilkat Support", "support@chilkatsoft.com") && Adds a recipient to the "to" list
loEmail.Subject = "Hi Matt! This is the VFP code that works with the progress." && The subject of the email
&& The ody of the email
loEmail.Body = "Its Tal here! Was pleasure talking to you. I am sending you this Email from the sample code, from VFP."
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
RETURN .T.
******************************************************************************
*Definition of control class:
DEFINE CLASS Ctrl as Session OLEPUBLIC
*The IMPLEMENTS... line below is what makes Foxpro take control over the SendPercentDone, ReadPercentDone and AbortCheck
*Long as you have DOEVENTS in it VFP keeps process events, although not as fast as normal.
*So while you download / send large Email you can keep using your program.
*NOTE - This path part of the IMPLEMENTS must point to the dll, so locate and correct it before you are using the program.
IMPLEMENTS _IChilkatMailEvents IN "c:\mydlls\chilkatmail_v7_9.dll"
nProgress = 0
PROCEDURE Init
ENDPROC
PROCEDURE _IChilkatMailEvents_SendPercentDone(percentDone AS Number, abort AS Number) AS VOID;
HELPSTRING "method SendPercentDone"
* add user code here
This.nProgress = percentDone
ACTIVATE SCREEN
@0,0 say "Sending: " + TRANSFORM(This.nProgress)
DOEVENTS
ENDPROC
PROCEDURE _IChilkatMailEvents_ReadPercentDone(percentDone AS Number, abort AS Number) AS VOID;
HELPSTRING "method ReadPercentDone"
* add user code here
This.nProgress = percentDone
@0,0 say "Reading: " + TRANSFORM(This.nProgress)
DOEVENTS
ENDPROC
PROCEDURE _IChilkatMailEvents_AbortCheck(abort AS Number) AS VOID;
HELPSTRING "method AbortCheck"
* add user code here
ENDPROC
ENDDEFINE
|
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