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

Formatting Email body

Status
Not open for further replies.

ezpzjohn

Programmer
Jun 29, 2001
50
GB
I am using VFP to produce the body of an email message from a table.

The table contains 2 columns, a code and a value. Examples might be:

Scode Svalue
1000 1234
1001 5678
1002 Apple

I am producing the formatted body along the following lines:

lcBody= ""
FOR i= 1 TO 3
lcBody= lcBody + Scode +"="+ Svalue + CHR(13)
ENDFOR

The intention is for the email body to look like this:
1000=1234
1001=5678
1002=Apple

But when I create the email the body comes out as:

1000=12341001=56781002=Apple

Is there another code I should be using instead of CHR(13)?

Thanks in advance

John

 

have you tried

lcBody= lcBody + Scode +"="+ Svalue + CHR(13)+chr(10)


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
John,

What method are you using for creating the email? I gather from your other thread that you are looking for a third-party product for this.

The first thing I would try is to use CHR(10) + CHR(13), rather than just CHR(13). That way, you get the line feed as well as the carriage return.

If you are using ShellExecute() with a mailto: link, you might have to format the body in a URL-compatible format. In gneral, that means replacing CHR(10) with %0A, and CHR(13) with %0D. I'm not completely sure about that -- it might depend on which client the user is using -- but you could experiment a bit.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Keepingbusy,

Your FAQ is interesting. It suggests that you need both %0d%0a and CHR(13) + CHR(10). That slightly surprises me, but I'll take your word for it.

Also, the example you showed includes a fairly long text in the body. Have you not come up against a limitation on the length? I've recently seen cases where ShellExecute() fails with a long message, but succeeds when I shorten it (but I haven't yet figured out exactly where the cut-off point is).

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
MikeLewis,

This might answer a few things for you regarding the length restriction:


boyd.gif

 
Hi Mike

The faq came about as a result of problem with the length of a string. I'm not sure if there would be a restriction as we've not encountered any problems as yet.

(May I give credit to the Tek-tips forum users who contributed to that faq)

Lee

VisFox Version 6 & 9 User / Windows XP
 
Mike

I am working on being able to get the codes/values into the correct format before deciding on what to use to send the email. For testing purposes I am using ShellExecute with Outlook Express.

The following code works perfectly:

lcBody= ""
FOR i= 1 TO 3
lcBody= lcBody + Scode +"="+ Svalue + "%0A"
ENDFOR

in producing the correctly formatted result. However I have encountered the size limitation in Outlook Express you mentioned. There is no error message from OE but only the first 216 characters of the body sent appear in the email!

The information being sent will be a minimum of about 1200 characters and could, if limitations allow, be as much as 50 times this. The submission has to be in the email body, not as an attachment, and the reply received will consist of a bunch of codes that have to be read back in by the application without user intervention.

Many thanks to all for your valued suggestions.

Any further suggestions will be welcome.

JOhn
 
Dear All

I have just read Craig's reply after posting mine. According to the Wiki link this size limitation appears to be just a problem with Outlook Express so I can forget about that problem as OE will not be used in the finished product.

John
 
John,

So it seems that %0A is all you need for a line break. That's useful to know.

this size limitation appears to be just a problem with Outlook Express

That's worth knowing too. My own experience of the size limitation arose with Outlook Express, and I never did get round to trying other clients. I ended up using Automation with the full Outlook.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top