send email using groovy script
Hello,
Can anyone send me the sample code to send an email using groovy script. I have gone through some restapi files but didn't get the output.
This is the code that i'm trying , no idea where i'm wrong.
Please suggest any idea on this and thanks in Advance
Code:
def sendEmail(connectionName,emailTo,emailSubject,emailBody,emailAttachments) {
HttpResponse<String> jsonResponse = operation.application.getConnection("EPBCS_TEST")
.post("/interop/rest/v1/services/sendmail")
.header("Content-Type", "application/x-www-form-urlencoded")
.queryParam("to", 'abc@gmail.com')
.queryParam("subject", 'Test email')
.queryParam("body", 'emailBody')
.asString();
println(jsonResponse.body)
}
Tagged:
0