send direct email from visual foxpro 9.0  
Author Message
jjvkm





PostPosted: Visual FoxPro General, send direct email from visual foxpro 9.0 Top

How to send e-mail from visual foxpro 9.0 without opening outlook

Visual FoxPro1  
 
 
Tomik





PostPosted: Visual FoxPro General, send direct email from visual foxpro 9.0 Top

Nice example of using MSMAPI in VFP 9 can be found here :

http://www.sweetpotatosoftware.com/SPSBlog/PermaLink,guid,8f569366-c76a-4873-9029-f31c07cf125e.aspx



 
 
MarciaAkins





PostPosted: Visual FoxPro General, send direct email from visual foxpro 9.0 Top

How to send e-mail from visual foxpro 9.0 without opening outlook

Look at CDO for Windows 2000 and later. To send messages, you must have network or local access to an SMTP or NNTP service. You must also have CdoSys.dll and Microsoft ActiveXR Data Objects (ADO) 2.5 installed. CDO for Windows 2000 is fully integrated with ADO, providing a consistent interface for managing the data that comprises a message. (Note that ADO is installed by default with Windows 2000, but CDO is an optional item).

*** create configuration and message objects

loConfig = CREATEOBJECT( 'CDO.Configuration' )

loMsg = CREATEOBJECT( 'CDO.Message' )

LPARAMETERS toParms

#DEFINE cdoSendEmailAddress "http://schemas.microsoft.com/cdo/configuration/sendemailaddress"

LOCAL lnCnt, lnLen

WITH loMsg

.Configuration = loConfig

.Configuration.Fields( cdoSendEmailAddress ).value =

.To = ALLTRIM( toParms.cTo )

.CC = ALLTRIM( toParms.cCC )

.Bcc = ALLTRIM(toParms.cBcc )

.Subject = ALLTRIM( toParms.cSubject )

*** Add any message text to the beginning of the body

.HTMLBody = [This is a test.]

.Send()

ENDWITH



 
 
Dave M.





PostPosted: Visual FoxPro General, send direct email from visual foxpro 9.0 Top

Unfortaunaly Now days Most ISP’s Block sending email from third party SMTP Servers, (Probably because of spammers). So you may need the following as well, this will specify a specific SMPT to use and provide the required info to connect to it.

loConfig.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
loConfig.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="smpt.myisp.com"
loConfig.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate")=1
loConfig.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") ="userid"
loConfig.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") ="password"
*loConfig.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") =.F.
loConfig.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 30
loConfig.Fields.Update


Dave M.



 
 
MarciaAkins





PostPosted: Visual FoxPro General, send direct email from visual foxpro 9.0 Top

Unfortaunaly Now days Most ISP’s Block sending email from third party SMTP Servers, (Probably because of spammers). So you may need the following as well, this will specify a specific SMPT to use and provide the required info to connect to it.

Thanks for jumping in with that, Dave. It reminded me that I forgot to mention that the easiest was to configure CDO is to make sure that Outlook Express (not Outlook) is installed and configured on the client machine. That way the necessary registry entries are there. It is not necessary to set Outlook Express as the default e-mail clinet. Installing and configuing is enough.