How to send email to multiple user

How to add multiple email address , Presently I am getting error if I add like (address:‘abc@gmail.com’,‘xyz@gmail.com’)

Also how create HTML email body from test report file which is in html?

task sendMail {

println “in the do email task”

    def mailParams = [

   mailhost: "smtp-xxx.gmail.com",

   mailport: "87",

    subject: "Pipeline Execution Test Report ",

   files:"/build/reports/cucumber-html-reports/overview-features.html",

    messagemimetype: "text/html",

    enableStartTLS: "true",

    ssl: "false"

]

    ant.mail (mailParams) {

    from (address:'no-reply@gmail.com')

    to (address:'abc@gmail.com')

    message ('<HTML><H1>message content here</H1></HTML>')

    }

}

I never used the Ant mail task, but I think you just use multiple to childs like:

ant.mail (mailParams) {
    from (address:'no-reply@gmail.com')
    to (address:'abc@gmail.com')
    to (address:'def@gmail.com')
    message ('<HTML><H1>message content here</H1></HTML>')
}

And to send HTML e-mail, you probably have to set the mimetype attribute of the message element or the messagemimetype of thee mail element to text/html as the default is text/plain.

1 Like