Created
May 10, 2017 14:44
-
-
Save chuikoaleksandr/c40d644f9adab08fece79605255ffdc0 to your computer and use it in GitHub Desktop.
ScriptRunner for JIRA
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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