How does one add line feeds to the body section of email prepared in VFP?
I'm using the ShellExecute method, as in:

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

where lcMail is built from vars holding adddress, subject, CC, body, etc.
data. All the sections work fine except for the body...it comes out as a
single long line of text. For example, if I define two line items I want
to put in the body, such as:

lcLine1 = 'hello world'
lcLine2 = 'goodbye'
lcBody = lcLine1 + lcLine2

I want it to appear in the email body as:

hello world
goodbye

Instead, it ends up on a single line as:

hello worldgoodbye

I've tried adding CR/LF's to it, as in:

lcLine1 = 'hello world' + chr(13) + chr(10)
lcLine2 = 'goodbye' + chr(13) + chr(10)

I've tried various combinations of chr(13) and chr(10), to no avail...the
body lines always just run together. This is VFP6(SP5) and Outlook
Express. What's the secret line feed character for email? I assume it's
the same for all email apps. Any suggestions? Thanks :)

Re: How to put line feeds into email sent by VFP? by Paul

Paul
Sun Sep 14 18:17:24 CDT 2003

I must be missing something ... my understanding of shellExecute is that it
sends a verb "open" to the controlling program for a particular file
extension. That would imply that lcMail contains the name of a ".oft" that
is already written onto the harddrive. Can you show the code that takes the
variables and actually creates the message. I have used carriage returns and
linefeeds in emails before and they worked.

"Java Monkey" <spammonkey@aaahawk.com> wrote in message
news:MPG.19ce68b713539356989689@msnews.microsoft.com...
> How does one add line feeds to the body section of email prepared in VFP?
> I'm using the ShellExecute method, as in:
>
> ShellExecute(0,"open",lcMail,"","",1)
>
> where lcMail is built from vars holding adddress, subject, CC, body, etc.
> data. All the sections work fine except for the body...it comes out as a
> single long line of text. For example, if I define two line items I want
> to put in the body, such as:
>
> lcLine1 = 'hello world'
> lcLine2 = 'goodbye'
> lcBody = lcLine1 + lcLine2
>
> I want it to appear in the email body as:
>
> hello world
> goodbye
>
> Instead, it ends up on a single line as:
>
> hello worldgoodbye
>
> I've tried adding CR/LF's to it, as in:
>
> lcLine1 = 'hello world' + chr(13) + chr(10)
> lcLine2 = 'goodbye' + chr(13) + chr(10)
>
> I've tried various combinations of chr(13) and chr(10), to no avail...the
> body lines always just run together. This is VFP6(SP5) and Outlook
> Express. What's the secret line feed character for email? I assume it's
> the same for all email apps. Any suggestions? Thanks :)
>



Re: How to put line feeds into email sent by VFP? by Boyd

Boyd
Sun Sep 14 21:43:45 CDT 2003

lcLine1 = 'hello world' + chr(13) + chr(10)
lcLine2 = 'goodbye'
lcBody = lcLine1 + lcLine2



Re: How to put line feeds into email sent by VFP? by Eric

Eric
Mon Sep 15 00:39:12 CDT 2003

Hello, Paul!
You wrote on Mon, 15 Sep 2003 09:17:24 +1000:

P> I must be missing something ... my understanding of shellExecute is that
P> it sends a verb "open" to the controlling program for a particular file
P> extension. That would imply that lcMail contains the name of a ".oft"
P> that is already written onto the harddrive. Can you show the code that
P> takes the variables and actually creates the message. I have used
P> carriage returns and linefeeds in emails before and they worked.

Not completely true. ShellExec runs the command you specify. It does not
need to be a (registered) file type/name). There is this mailto: command
that receives a few parameters such as To and CC:
<vfp_code>
DECLARE INTEGER ShellExecute ;
IN SHELL32.DLL ;
INTEGER nWinHandle,;
STRING cOperation,;
STRING cFileName,;
STRING cParameters,;
STRING cDirectory,;
INTEGER nShowWindow

lcEmailAddress = "somebody@somewhere.com"
lcCCAddress = "somebody@somewhere.com"
lcSubject = "This is a test message"
lcMessageBody = "Hello, this is a message body."

ShellExecute(0, "", "mailto:" + lcEmailAddress + "?Subject=" + lcSubject + ;
"&CC=" + lcCCAddress + "&body=" + ;
lcMessageBody, "", "",1)
</vfp_code>

--
Eric den Doop
www.foxite.com - The Home Of The Visual FoxPro Experts - Powered By VFP8



Re: How to put line feeds into email sent by VFP? by Java

Java
Mon Sep 15 02:21:19 CDT 2003

Perhaps I used the term 'send mail' too loosely...it doesn't actually
send the email, it prepares the contents (address, subject, body, etc.),
opens the default email application with an empty new email, and stuffs
the contents into the appropriate places. The user can then review it,
modify it, add an attachment, or whatever...and then has to click Save or
Send to actually send the thing. Anyway, here is the code I've tried out
in creating my test to see how it all works. Ultimately, I'll use real
data, vars, etc. but the idea is the same: I want to 'compose' emails
using VFP which will have multiple lines of body text. So if anyone can
tell me how to get those line feeds into the body, I'll be ever so happy!

declare integer ShellExecute in shell32.dll ;
integer hndWin, string cAction, string cFileName, ;
string cParams, string cDir, integer nShowWin
lcAddress = "mailto:" + alltrim(ThisForm.cboAddress.displayvalue)
lcCopy = iif(!empty(ThisForm.cboEmailCopy.displayvalue),'?CC=' ;
+ alltrim(ThisForm.cboEmailCopy.displayvalue),'')
lcSubject = '&Subject=Meeting plans'
lcDate = 'Meeting date: ' + ;
dtoc(ThisForm.Ccalendardate1.txtdate.value) + ;
chr(13) + chr(10)
lcTime = 'Meeting time: ' + ThisForm.txtTime.value + ;
chr(13) + chr(10)

do case
case ThisForm.opgLocation.value = 1
lcPlace = 'Location: Office' + chr(13) + chr(10)
case ThisForm.opgLocation.value = 2
lcPlace = 'Location: Client' + chr(13) + chr(10)
case ThisForm.opgLocation.value = 3
lcPlace = 'Location: ' + ThisForm.edtLocation.text ;
+ chr(13) + chr(10)
endcase

do case
case ThisForm.opgReturnAction.value = 1
lcFollowup = 'I will phone you after our meeting' ;
+ chr(13) + chr(10)
case ThisForm.opgReturnAction.value = 2
lcFollowup = 'I will email you after our meeting' ;
+ chr(13) + chr(10)
case ThisForm.opgReturnAction.value = 3 && No followup
lcFollowup = ''
endcase

lcBody = '&Body=lcDate + lcTime + lcPlace + lcFollowup

lcMail = lcAddress + lcCopy + lcSubject + lcBody

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



In article <uqisSXxeDHA.3204@TK2MSFTNGP11.phx.gbl>,
paulnospam@laberg.com.au says...
> I must be missing something ... my understanding of shellExecute is that it
> sends a verb "open" to the controlling program for a particular file
> extension. That would imply that lcMail contains the name of a ".oft" that
> is already written onto the harddrive. Can you show the code that takes the
> variables and actually creates the message. I have used carriage returns and
> linefeeds in emails before and they worked.
>

Re: How to put line feeds into email sent by VFP? by Leonid

Leonid
Mon Sep 15 04:17:04 CDT 2003

Hi,

Try

lcLine1 =3D 'hello world' + '%0D%0A'
lcLine2 =3D 'goodbye' + '%0D%0A'

Leonid


"Java Monkey" <spammonkey@aaahawk.com> wrote in message =
news:MPG.19ce68b713539356989689@msnews.microsoft.com...
> How does one add line feeds to the body section of email prepared in =
VFP? =20
> I'm using the ShellExecute method, as in:
>=20
> ShellExecute(0,"open",lcMail,"","",1)
>=20
> where lcMail is built from vars holding adddress, subject, CC, body, =
etc.=20
> data. All the sections work fine except for the body...it comes out =
as a=20
> single long line of text. For example, if I define two line items I =
want=20
> to put in the body, such as:
>=20
> lcLine1 =3D 'hello world'
> lcLine2 =3D 'goodbye'
> lcBody =3D lcLine1 + lcLine2
>=20
> I want it to appear in the email body as:
>=20
> hello world
> goodbye
>=20
> Instead, it ends up on a single line as:
>=20
> hello worldgoodbye
>=20
> I've tried adding CR/LF's to it, as in:
>=20
> lcLine1 =3D 'hello world' + chr(13) + chr(10)
> lcLine2 =3D 'goodbye' + chr(13) + chr(10)
>=20
> I've tried various combinations of chr(13) and chr(10), to no =
avail...the=20
> body lines always just run together. This is VFP6(SP5) and Outlook=20
> Express. What's the secret line feed character for email? I assume =
it's=20
> the same for all email apps. Any suggestions? Thanks :)
>=20


Re: How to put line feeds into email (New Problem) by Eric

Eric
Tue Sep 16 02:13:25 CDT 2003

Hello, Java!
You wrote on Tue, 16 Sep 2003 00:08:18 -0700:

JM> So does anyone know another method to prepare/send emails via VFP, one
JM> that will allow longer messages? I considered Blat but the big
JM> drawback is that the sent mails aren't saved in the user's email app
JM> Outbox/Sent Items/etc. I'm not keen on building a secondary email app
JM> into the VFP app which would store the sent mail, nor do I think most
JM> users would want to have to check multiple programs to find who sent
JM> what to whom and when, etc. It'd be much better if I could use VFP to
JM> compose the mail but the user's default email app to send and store it.

MAPI is an alternative. It requires a MAPI compliant mail client like
Outlook, Outlook Express and Agent. I believe THe Netscape mail program is
MAPI complait too, as well as Notes.
--
Eric den Doop
www.foxite.com - The Home Of The Visual FoxPro Experts - Powered By VFP8