Forum Discussion

vikranthsanka15's avatar
vikranthsanka15
Occasional Contributor
10 years ago

New line in Groovy Script.

Hi,

I have to mail the Test results after the Test Suite is run. Im using ActiveXObject for opening the outlook mail ready for sending. I've used the below code for this


import org.codehaus.groovy.scriptom.ActiveXObject
def outlook = new ActiveXObject("Outlook.Application")

def oEmail = outlook.CreateItem(0);
oEmail.Recipients.Add("vikranth_sanka@xyz.com");
oEmail.Subject = "SmokeTest";
oEmail.HTMLBody = "Smoke Test done successfully in \r\n xyz and pqr Environments.";


But the Body of the Mail is still appearing in single line though I have used \r\n. Is there any other way to use new line feature for this.

2 Replies

  • soapug's avatar
    soapug
    New Contributor
    This has nothing to do with Groovy or e-mail (or SoapUI for that matter).

    The issue is that HTML formatting is not like text. You add new lines in HTML using the <br /> tag.

    The alternative is not to use HTML for the e-mail body. Just use plain text.