Linefeeds in an email body

I populate a text area for the ‘body of my message’ on a listbox change event. This just gives the user a preview of what the email body is going to look like. They can’t edit it.

while not sessions.eof //next line because titlecase does not seem to work dname=mid(sessions.field("Event_Dayname").StringValue,1,1)+lowercase(mid(sessions.field("Event_Dayname").StringValue,2)) tmp=tmp+dname+", "+fromsql(sessions.field("Event_Date").stringvalue)+", "+sessions.field("Event_Session").stringvalue+"00hrs, "+sessions.field("Booked").stringvalue+" places booked."+EndOfLine sessions.MoveNext wend

When I then later use the following code to add the details to an email message;

mail.bodyPlainText = edtMessage.text mail.bodyHTML = edtMessage.text

All I get in the email message that arrives is a long line of all the comntents without the line feeds. All suggestions welcome, I am sure its a simple one but its been a long day :frowning:

Try this:

  dim txt as string = ReplaceLineEndings( edtMessage.text, EndOfLine.Windows )
  mail.bodyPlainText = txt
  mail.bodyHTML = txt

Kem, that didn’t seem to work, the resulting text was still a continuous line without the linefeeds.

When I view it in the debugger, mail message, text, it looks formatted OK, when the email arrives after sending however it is one continuous line.

If you send html then the text should in fact be html. So at least do a

mail.bodyHtml = replaceAll(txt, EndOfLine, “

Beatrix, that was the answer, sending the non html after the plain text was causing the message to appear flat, i.e. the malformed HTML was overwriting the plain text version, its always the obvious stuff :frowning:

I don’t use HTML in messages so will just avoid the line altogether.