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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Assistance with email syntax

Status
Not open for further replies.

Bryan - Gendev

Programmer
Jan 9, 2011
408
AU
Could someone correct my syntax for an email please...


lcMail = "mailto:robin.denzil@internode.on.net";
+ "BCC = "bredub@internode.on.net";
+ "&Subject= Results of analysis";
+ "&Body= Dear User, ";
+%OA,;
+ " Thank you for running our analysis tool! ;
+%OA,;
+ "Please attach your results *.csv FILE from the data folder you chose within the program."

Thanks

GenDev
 
Your code will give you a syntax error. That's because your double-quote marks are all wrong.

You need to: remove the double-quotes before the email address; add double-quote after analysis tool; and put double-quotes around the two instances of %OA.

That should give you the correct syntax. After that, it's just a question of calling ShellExecute(). I assume you know how to do that.

You might also find this article useful:
An easy way to send email from a Visual FoxPro application

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
It's much neater to do this sort of thing with a TEXT / ENDTEXT construct:

Code:
TEXT TO lcMail NOSHOW 
mailto:robin.denzil@internode.on.net
?BCC = "bredub@internode.on.net
&Subject= Results of analysis
&Body= Dear User,%OAThank you for running our analysis tool!%OA
Please attach your results *.csv FILE from the data folder you chose within the program.
ENDTEXT

That way, you don't have to worry about the line endings or string delimiters at all.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Hi Mike,

I was using your article to get me going.

Unfortunately using your TEXT construct my email ( Thunderbird ) doesn't open.

This original runs OK but I wanted to format it

Code:
	lcMail = "mailto:bresoft@internode.on.net";
	 + "?Subject= Results of analysis";
	 + "&Body= Dear User, ";
	 + " Thankyou for running our analysis tool! Please add your results FILE (data.xls)       from the data folder you chose within the program.";

Any thoughts?

Gendev
 
Mike further to my last post ,

I noticed ?BCC = "bredub@internode.on.net so I removed the " .

Now it runs but gives me

Dear User,%OAThank you for running our analysis tool!%OAPlease attach your results

Thanks

GenDev
 
As I said it does work but isn't formatted - see above

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

LOCAL lcMail

TEXT TO lcMail NOSHOW 
mailto:robin.denzil@internode.on.net
?BCC = bredub@internode.on.net
&Subject= Results of analysis
&Body= Dear User,%OAThank you for running our analysis tool!%OA
Please attach your results *.csv FILE from the data folder you chose within the program.
ENDTEXT 

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

Clear DLLS ShellExecute

Thanks
GenDev
 
Glad to be of help. But, you know, if you had said in your first post that the problem was that the line endings weren't showing, rather than asking for a general correction for your syntax. I might have seen the problem straight away.

Never mind. I'm glad it's sorted now.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top