formadmirer
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
and sendErrorEmail in email_functions.prg looks like:
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?
I have a button on a form with
lcError = "This is a TEST message!"
DO sendErrorEmail IN email_functions WITH lcError
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
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Tried it but all I got was:
<>
<>
ASKER
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!
Went to your link, saw I had to SEt TEXTMERGE to ON.
Tried it again and it works - thank you!
ASKER
Thanks!
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.
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.
ASKER
I'll give it a try now - thanks!