Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I use a record from a DBF and send it with other variables to an email but with spaces between paragraphs

COM and Automation

How can I use a record from a DBF and send it with other variables to an email but with spaces between paragraphs

by  keepingbusy  Posted    (Edited  )
First off, let me give credit where it's due: SlightHaze, Ramani and Steveb7

After advice from the above Tek-Tips users we were able to solve a problem that may help you. The only way to show you this is by pasting the whole code we used to get there in the end. I'm sorry it's long winded but it works and I have no doubts that the experts out there will pull it apart and condense it somewhat to all our advantage. Anyway, I hope it helps someone so here was the problem.

We needed to select a record from our DBF, add some information, put it into paragraphs then send the whole thing to an email with the click of a command button. Some of the original wording has been altered using *** so please amend it and try your own. Here it is...

nmessage=MESSAGEBOX("Email Reminder To This Recipient?"+space(15),4+32+0,"System Message")
IF nmessage=7
RETURN 0
ENDI

DECLARE integer ShellExecute IN shell32.dll ;
integer hndWin, string cAction, string cFileName, ;
string cParams, string cDir, integer nShowWin

LOCAL cEmail, memailtx1, memailtx2, memailtx3, memailtx4, memailtx5, memailtx6, ;
memailtx7, memailtx8, memailtx9, memailtx10, memailtx11, memailtx12, memailtx13, ;
memailtx14, memailtx15, memailtx16, memailtx17, memailtx18, memailtx19, memailtx20, ;
mserialfm, mserialto

memailtx1 = "Dear Certificate Holder%0d%0a"
memailtx2 = " %0d%0a"
memailtx3 = "We would like to remind you that your current donation to the"+ ;
" *** Foundation is about to expire soon and the last draw you are entitled "+ ;
"to take part is due on "+cdow(date12)+" "+dmy(date12)+".%0d%0a"
memailtx4 = " %0d%0a"
memailtx5 = "If you renew your ú"+LTRIM(STR(amount))+" certificate, you will have "+LTRIM(STR(amount))+ ;
" opportunities in every one of a total of 12 *** Prize Fund draws giving you"+ ;
" an overall opportunity level of "+LTRIM(STR(amount*12))+" throughout the 12 *** Draws.%0d%0a"
memailtx6 = " %0d%0a"
memailtx7 = "You can increase your donation or keep it the same and may do so by either contacting us by "+ ;
"telephone or by registering a new donation online at ourukwebsitename %0d%0a"
memailtx8 = " %0d%0a"
memailtx9 = "Thank you for taking part in the *** experience and we look forward to hearing from you.%0d%0a"
memailtx10= " %0d%0a"
memailtx11= "Yours faithfully,%0d%0a"
memailtx12= " %0d%0a"
memailtx13= " %0d%0a"
memailtx14= "For the *** Foundation%0d%0a"
memailtx15= " %0d%0a"
memailtx16= "Your existing reference numbers are below%0d%0a"
memailtx17= " %0d%0a"
memailtx18= "From: ["+LTRIM(STR(SERFMNO))+"/"+SERFMLET+"/"+LTRIM(STR(SERIALFM))+"/"+SERFMENLET+ ;
"] To: ["+LTRIM(STR(SERTONO))+"/"+SERTOLET+"/"+LTRIM(STR(SERIALTO))+"/"+SERTOENLET+"]%0d%0a"

cEmail = "mailto:"+LOWER(TRIM(EMAIL))+"?Subject=Certificate Renewal Reminder"+ ;
"&Body= " + memailtx1 + chr(13) + chr(10) + memailtx2 + chr(13) + chr(10) + memailtx3 + ;
memailtx4 + chr(13) + chr(10) + memailtx5 + chr(13) + chr(10) + memailtx6 +chr(13) + chr(10) + ;
memailtx7 + chr(13) + chr(10) + memailtx8 + chr(13) + chr(10) + memailtx9 +chr(13) + chr(10) + ;
memailtx10 + chr(13) + chr(10) + memailtx11 + chr(13) + chr(10) + memailtx12 +chr(13) + chr(10) + ;
memailtx13 + chr(13) + chr(10) + memailtx14 + chr(13) + chr(10) + memailtx15 +chr(13) + chr(10) + ;
memailtx16 + chr(13) + chr(10) + memailtx17 + chr(13) + chr(10) + memailtx18

ShellExecute(0,"open",cEMail,"","",1)

CLEAR DLLS ShellExecute

So there it is. This works using VFP version 6 and Outlook Express Version 6

Good luck

Lee (KB)
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top