I had written a small function to return the HTML format of a string and would like to expand on it or use something better. I use the returned content of the function to send it in the body of my emails within my VFP9 app.
Here is my small function
I do not have any complex formatting to do but would like to send more than one paragraph. Let's say for example I have an edit text box for the user to enter some sentences, or paragraphs. I would then use the content of that text and call my function to format the content to HTML and then I call my email program to send the email as HTML.
Currently my function will obviously return:
"Sentence 1. Sentence 2. Sentence 3."
However, I would like it to return each sentence in a separate paragraph as in :
"Sentence 1.
Sentence 2.
Sentence 3."
I can do some coding to look for the carriage returns and all to put them in a different paragraph, but this might be too tedious. I am sure there are better ways of doing this and would like your help or suggestions please.
Just a note. I do not need help on how to send emails using VFP because I am already doing so with no problems.
Many thanks,
Mike
Here is my small function
Code:
FUNCTION formathtmlbody
PARAMETERS html_Body
ret_val = ;
'<!DOCTYPE html>'+chr(13)+;
'<html>'+chr(13)+;
'<body>'+chr(13)+;
'<p>' + html_Body + '</p>'+chr(13)+;
'</body>'+chr(13)+;
'</html>'
RETURN (ret_val)
ENDFUNC
I do not have any complex formatting to do but would like to send more than one paragraph. Let's say for example I have an edit text box for the user to enter some sentences, or paragraphs. I would then use the content of that text and call my function to format the content to HTML and then I call my email program to send the email as HTML.
Code:
My_Text_Entered = formathtmlbody("Sentence 1" + chr(13) + "Sentence 2" + chr(13) + "Sentence 3" + chr(13))
=MyEmailFunction(My_Text_Entered)
Currently my function will obviously return:
"Sentence 1. Sentence 2. Sentence 3."
However, I would like it to return each sentence in a separate paragraph as in :
"Sentence 1.
Sentence 2.
Sentence 3."
I can do some coding to look for the carriage returns and all to put them in a different paragraph, but this might be too tedious. I am sure there are better ways of doing this and would like your help or suggestions please.
Just a note. I do not need help on how to send emails using VFP because I am already doing so with no problems.
Many thanks,
Mike