You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

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)

}

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!