Link to home
Start Free TrialLog in
Avatar of formadmirer
formadmirerFlag for United States of America

asked on

VPFWinsock Email Content Text Variable

Hi all. I have a question for someone familiar with vfpwinsock's email capabilities.

I have a button on a form with
lcError = "This is a TEST message!"
DO sendErrorEmail IN email_functions WITH lcError

Open in new window


and sendErrorEmail in email_functions.prg looks like:
FUNCTION sendErrorEmail
LPARAMETERS lcError

set proc to vfpWinsock
local loSendMail
loSendMail=CREATEOBJECT("VFP_Winsock_Send_Mail")
loSendMail.SMTP_Host = "mail.mymailserver.com"
loSendMail.FROM = "admin@mydomain.com"
loSendMail.FROM_NAME = "Admin"
loSendMail.AUTH_LOGIN = "admin@mydomain.com"
loSendMail.AUTH_PASSWORD = "topsecret_password"
loSendMail.TO = "errors@mydomain.com"
loSendMail.TO_NAME = "Errors"
loSendMail.Subject = "Error Report"
TEXT to loSendMail.MESSAGE noshow
	lcError
ENDTEXT
TEXT to loSendMail.MessageHTML noshow
<HTML>
  <BODY>
	lcError
  </BODY>
</HTML>
ENDTEXT
if not loSendMail.send() 
  =MESSAGEBOX(loSendMail.erreur,16,"Error") 
endif
loSendMail=.null.
RETURN

Open in new window


and I get the email fine, but the email simply says:
lcError

I've tried single quotes, double quotes, parenthesis, all the usual things around lcError but all I ever get is lcError.

What am I doing wrong?
ASKER CERTIFIED SOLUTION
Avatar of peterhupp
peterhupp
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of formadmirer

ASKER

That's a new one for me, I've never seen <<x>> before.
I'll give it a try now - thanks!
Tried it but all I got was:
<>
I know, I'm a dummy...
Went to your link, saw I had to SEt TEXTMERGE to ON.
Tried it again and it works - thank you!
Thanks!
Avatar of Olaf Doschke
Actually you just need the TEXTMERGE option in your TEXT ... ENDTEXT to get <<expression>> to work, like peter showed.

That works with Set Textmerge On or Off. That Textmerge option only is needed, if you work with \ and \\:
http://msdn.microsoft.com/en-us/library/x1f5xasa(v=vs.80).aspx
http://msdn.microsoft.com/en-us/library/0zzd7z64(v=vs.80).aspx

Then there also is a Textmerge() function, but TEXT...ENDTEXT is perfect to create a mail body.

Bye, Olaf.