Wiki Home

xpsendmailand VFP


Namespace: VFP
See Also: Automated Email

* This code calls xp_sendmail on SQL Server
* ----------------------------------------
OPEN DATABASE MyDBCWithAConnectionInIt
lnHandle = SQLCONNECT('ConnectionName')	&& or could use other ways to get connect handle
CLOSE DATABASE
* ----------------------------------------

lcMessageText		= "Message Text - from SQL Server"
lcRecipients 		= [email protected]'
lcCopy_Recipients	= [email protected]'
lcSubject		= 'Subject - email from SQL Server'

* Note the "master" prepended to xp_sendmail call
dxSQLReturn = SQLEXEC(m.lnHandle, "exec master..xp_sendmail @recipients=?lcRecipients,;
		@copy_recipients=?lcCopy_Recipients,;
		@attachments='\\fchdb001\$chssql2\dxbTestDoc.TXT',;
		@subject=?lcSubject,;
		@message=?lcMessageText")

* ---------------------
SQLDISCONNECT(lnHandle)
* ---------------------



Category SPT, Category Code Samples
( Topic last updated: 2006.02.27 11:01:47 AM )