I've tried the following code and had no luck. Does anyone have a simple script or any guidance?
import com.atlassian.mail.Email; import com.atlassian.mail.server.MailServerManager; import com.atlassian.mail.server.SMTPMailServer; subject = "test" body = "test" emailAddr = "email@whatever.com" def sendEmail(emailAddr, subject, body) { SMTPMailServer mailServer = ComponentManager.getInstance().getMailServerManager().getDefaultSMTPMailServer(); if (mailServer) { Email email = new Email(emailAddr); email.setSubject(subject); email.setBody(body); mailServer.send(email); } else { // Problem getting the mail server from JIRA configuration, log this error } }
You're missing the line like:
sendEmail (emailAddr, subject, body)
Adding "import com.atlassian.jira.ComponentManager" and actually calling sendMail did the trick. Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.