****************************************************************************** * Procedure file: SENDEMAIL.PRG ****************************************************************************** * Calls the user's default email client and passes the recipient's email address, * email subject, and email textbody. * The email client is launched but the user must manually click on SEND. * Based on whitepapers from http://www.west-wind.com/articles.asp ****************************************************************************** * Example Use: * sendemail('myemail@mymailserver.com','Subject Line','Text body of message') ****************************************************************************** * lparameters tcRecipient,tcSubject,tcBody return GoSite("mailto:" + tcRecipient + ; "&Subject=" +strtran(UrlEncode(tcSubject),"+"," ") +; "&Body=" + strtran(UrlEncode(tcBody),"+"," ")) *---------------------------------------------------------------- function GoSite(tcUrl, tcAction, tcDirectory, tcParms) if empty(tcUrl) return -1 endif if empty(tcAction) tcAction = "OPEN" endif if empty(tcDirectory) tcDirectory = sys(2023) endif if empty(tcParms) tcParms = "" endif declare integer ShellExecute ; in SHELL32.dll ; integer nWinHandle,; string cOperation,; string cFileName,; string cParameters,; string cDirectory,; integer nShowWindow declare integer FindWindow ; in WIN32API string cNull,string cWinName return ShellExecute(FindWindow(0,_screen.caption),; tcAction,tcUrl,; tcParms, tcDirectory,1) *------------------------------------------------------------------ function UrlEncode( tcValue, llNoPlus ) local lcResult, lcChar, lnSize, lnX lcResult="" for lnX=1 to len(tcValue) lcChar = substr(tcValue,lnX,1) if atc(lcChar,"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789") > 0 lcResult=lcResult + lcChar loop endif if lcChar=" " and !llNoPlus lcResult = lcResult + "+" loop endif *** Convert others to Hex equivalents lcResult = lcResult + "%" + right(transform(asc(lcChar),"@0"),2) endfor return lcResultLook familiar?