Sending mail via CDO

E

Ed_R

I'm sending mail using CDO. The user creats their message in a memo
field on a form and submits it . The message is formatted via HTML .
Message is being sent, everything was ok except I noticed I wasn't
getting hard spaces in message body where I wanted them. So added the
text below and that fixed that

Yesterday though when I sent a mesaage, I noticed that there are no
carraige returns in my message unless I insert one. My memo field is
about 80 charactors wide. Once the typing goes to the right side, it
auto wraps in the screen to the next line just like a document in Word
does. However when receiving the email everything is all on one line.
Lines would scroll way off to the right. If when typing the message,
after maybe three lines, I had skipped a line for a new paragraph,
there would also be a corrisponding line skip in the email as expected.
But other than these hard spaces, the text is continuous.

I'm not sure, maybe it had been behaving like this all along, but only
noticed it yesterday, after I added the text below. Could adding that
somehow screw up word wrap or was it already bad and I just didn't
notice. Though at least two recepients of the message I sent yesterday
als onoticed it for the first time.

More importantly, how can I fix this so the messges have a line break
every 80 or so charactors in addition to any hard line breaks I enter
manually.

'Add Br and   charators to format html properly

'Replace all vbCrLf with <BR>s
message_text_value = Replace(message_text_value, vbCrLf, "<BR>")

'Replace all spaces with &nbsp;
message_text_value = Replace(message_text_value, " ", "&nbsp;")
 
T

Thomas A. Rowe

Suggest you try a ASP newsgroup as this is really not a FP related issue.

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
==============================================
If you feel your current issue is a results of installing
a Service Pack or security update, please contact
Microsoft Product Support Services:
http://support.microsoft.com
If the problem can be shown to have been caused by a
security update, then there is usually no charge for the call.
==============================================
 
J

Jim Buyens

Try adding wrap="hard " or wrap="off" (not sure which) to your <textarea> tag.
This will stop the browser from throwing away any line endings that the
visitor enters.

wrap="soft" is the default. Text is displayed with
wordwrapping and submitted without carriage
returns and line feeds.
wrap="hard" Text is displayed with wordwrapping and
submitted with soft returns and line feeds.
wrap="off" Wordwrapping is disabled. The lines appear
exactly as the user types them.

Then, when formatting your message, change all line endings to <br> tags.
Here's an example:

strMsgBody = strMsgBody & _
replace(server.htmlencode(Request.Form("txtComment")), vbCrLf, "<br>")

Jim Buyens
Microsoft MVP
http://www.interlacken.com
Author of:
o--> Microsoft Visual Web Developer 2005 Express Edition: Build a Web Site
Now!
o--> Microsoft Office FrontPage 2003 Inside Out
o--> Microsoft Windows SharePoint Services Inside Out
o--> Faster Smarter Beginning Programming
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top