Can't seem to add a line feed to the end of HTMLBody (<br /> tag getting trimmed)

157 views Asked by At

We're creating an Outlook mailitem and setting up a part of the message body. However the client wants the message body to end with a clean fresh line so he can add further text.

It's a trivial request but ...

It seems adding anything which isn't a character or else &nbsp; to the end of .HTMLBody is ignored/trimmed off.

We want our mail message to end with a new line but we're finding:


tried 1

x.HTMLBody = CustomerName & "," & "<p>" 

and

x.HTMLBody = CustomerName & "," & "<br>"

and

x.HTMLBody = CustomerName & "," & "<br><br>"

all result in:

Mr MAWHOOD,
           ^ = cursor positioned here

this isn't what the client wants ... he wants the cursor to start on a fresh line


tried 2

x.HTMLBody = CustomerName & "," & "<br>&nbsp;"

results in:

Mr MAWHOOD,

 ^ = cursor positioned here (one space in)

this is slightly better ... but still client wants to know why we have this "hacky" space on our new line


tried 3

x.HTMLBody = CustomerName & "," & "<p>&nbsp;</p><br />"

results in:

Mr MAWHOOD,



^ = cursor positioned here (correct, but now two lines down)

strange that the only way to get a new trimmed line is we accept we have to have two of them?


1

There are 1 answers

1
jojois74 On

You should try your second approach, but add the

&#08;

HTML character at the end. This is the backspace character, and may take off that "hacky" space after the line break. So

x.HTMLBody = CustomerName & "," & "<br />&nbsp;&#08;"

I found it here: http://www.w3schools.com/TAGS/ref_ascii.asp However I can't be certain it will work, and it probably won't....