Skip to content

Instantly share code, notes, and snippets.

@chuikoaleksandr
Created May 10, 2017 14:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chuikoaleksandr/c40d644f9adab08fece79605255ffdc0 to your computer and use it in GitHub Desktop.
Save chuikoaleksandr/c40d644f9adab08fece79605255ffdc0 to your computer and use it in GitHub Desktop.
ScriptRunner for JIRA
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.mail.Email
def sendEmail(String emailAddr, String subject, String body) {
def mailServer = ComponentAccessor.getMailServerManager().getDefaultSMTPMailServer()
if (mailServer) {
email = new Email(emailAddr)
email.setSubject(subject)
email.setBody(body)
email.setMimeType("text/html; charset=utf-8")
mailServer.send(email)
log.debug("Mail sent")
} else {
log.warn("Please make sure that a valid mailServer is configured")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment