Environment.NewLine didn't work in two cases

Hello,

I didn’t observe this situation until now but I can’t figure out how to solve it.
I will explain the issue with an exemple:

I will store into variable “test_String” the following string “Hello”+Environment.NewLine+“Thanks”.

  1. I want to use this variable into a Body mail. When I send the email, that Environment.NewLine is not read and the mail body will be: “Hello,Thanks” and not
    “Hello,
    Thanks”

  2. Same scenario if I want to use a Type into to add the contect of “test_String” into a field.

How can I solve this issue to display the content of a custom string variable?

Thank you in advance,
Vlad

1 Like

@VladTof

For Mail you can use as below

<html><body><p>Hello</p><br><p>Thanks</p></body></html>

Makesure you enabled IsHTML in properties

Hope this helps

Hi @VladTof,

while dealing with scenarios like that in email body environment.new line does not work in such scenarios you have to use html tags to give a line break where you want .

Just ad an html element to break your line in the variable where you stored the data and it will work.

Thanks,
Shikhar

Hello,

I am still using Environment.NewLine in the mail body and if I set IsHTML only for my variable will not help because I will broke the rest of the body.

Hello,

If I’m using Environment.NewLine in the mail body and if I set IsHTML only for my variable to work, will not help, because I will broke the rest of the body.

@VladTof

If you enable IsHTML that means you have to follow the HTML code, not the environment codes

Build a HTML template to define your body and it will works fine

Hope this helps

Thanks

1 Like

Yes, I know but I wanted to avoid to creat an entire HTML template.

Just make another variable for the parts you want to use as an html , describe that variables with the value you want and then pass those variables in your existing mail body .

this will not break rest of the body.

Thanks,
Shikhar

I’m not sure If I understood well.
If I store into a variable “Hello,”+“
”+“Thanks” and I will not check IsBodyHtml (because I have already used in the body Environment.NewLine) the display text will be “Hello,
Thanks”.

By the way, I have just retested my issue with the mail and it worked with Environment.NewLine in the variable. I don’t know what is wrong with the cases when it didn’t work…

Hi,
You can also try using vbcr or vbcrlf instead of Environment.NewLine

e.g. "Kind regards,"+vbcr+vbcr+"The robot" would give you

Kind regards,

The robot

1 Like

Hi Vlad,

Try this way,

1.“Hello,”+Environment.NewLine+
2.“Thanks”