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

CDO plain text email and carriage return problems

Status
Not open for further replies.

theniteowl

Programmer
May 24, 2005
1,975
US
Hi All,
I am trying to send plain text emails using CDO in a .vbs file. The email data is read from a text file generated in another application.
Either CDO or Outlook is stripping the carriage returns so the text comes out all on one line. Outlook shows a message "Extra line breaks in this message were removed".

When my script reads the text file to build the message it reads line by line. Line breaks are already inserted by the program that generated the text file. If I try to add a vbCrLf at the end of each line I end up with two carriage returns and if I do not add it I end up with no carriage returns.
Ideas?

I know I can format as HTML and handle it that way but I need the app to be able to be called from various other applications with limited capabilities and want to support HTML or TEXT settings.
I have seen a lot of people post about carriage return problems but all of their solutions were to use HTML.

At my age I still learn something new every day, but I forget two others.
 
I found my own solution.
The application creating the text file was adding carriage returns as it should. Outlook strips what it considers to be extra carriage returns.
I found that adding three spaces at the end of the line before the carriage return in the text file and then adding a carriage return in my .vbs file as it builds the content of the message variable Outlook will properly insert ONE carriage return.

It is quite a work-around and I now have to remember in any app that generates the text file for sending an email that I need three spaces at the end of each line I want a return at but it works.

At my age I still learn something new every day, but I forget two others.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top