[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

VPFWinsock Email Content Text Variable

Posted on 2012-09-19
7
Medium Priority
?
615 Views
Last Modified: 2012-09-19
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?
0
Comment
Question by:formadmirer
  • 4
  • 2
7 Comments
 
LVL 3

Accepted Solution

by:
peterhupp earned 2000 total points
ID: 38414713
in your missing the textmerge and the <<>> around your variable.

TEXT to loSendMail.MESSAGE textmerge noshow

<<lcError>>

ENDTEXT
0
 

Author Comment

by:formadmirer
ID: 38414761
That's a new one for me, I've never seen <<x>> before.
I'll give it a try now - thanks!
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:formadmirer
ID: 38414826
Tried it but all I got was:
<>
0
 

Author Comment

by:formadmirer
ID: 38414846
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!
0
 

Author Closing Comment

by:formadmirer
ID: 38414847
Thanks!
0
 
LVL 30

Expert Comment

by:Olaf Doschke
ID: 38415336
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.
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Visual FoxPro (short VFP) is a programming language with it’s own IDE and database, ranking somewhat between Access and VB.NET + SQL Server (Express). Product Description: http://msdn.microsoft.com/en-us/vfoxpro/default.aspx (http://msd…
Applications for our next round of the Experts Exchange Scholarship Contest are starting to roll in. It made us wonder what our past winners are up to these days. Here's a look at what four winners experienced with the contest and what they're doing…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Screencast - Getting to Know the Pipeline

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question