Hey there,
For sending e-mails with a workflow-transition I used the Scriptrunner post function "Send custom e-mail".
Now some user-rights changed in my company.
Via Post-Function I'm not able to use mail.setFrom("mymail@adress,com") in my scripts anymore. But its very important in this project to set a custom e-mail address as sender.
I think from now on I need to send the e-mails as a specific user (with the rights to use the mail.setFrom), so I think I will switch to "custom script post-function".
How can I add a specific user as sender in my custom script?
What I know is this:
def sendEmail(String emailAddr, String subject, String body) {
SMTPMailServer mailServer = ComponentAccessor.getMailServerManager().getDefaultSMTPMailServer()
if (mailServer) {
Email email = new Email(emailAddr)
email.setSubject(subject)
email.setBody(body)
mailServer.send(email)
log.debug("Mail sent")
} else {
log.warn("Please make sure that a valid mailServer is configured")
}
}
How can I change this script to use
1. another Jira-User with the rights to use "mail.setFrom"
or
2. another smtp server with specified user, password, port, etc.
for sending e-mails?
Thank you so much in advance!