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.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.