Hello,
I want to change the sender of sendEmail I did in Groovy.
this is my code:
def sendEmail(String emailAddr, String subject, String body) {
//MailServerManager mailServerManager = ComponentAccessor.getMailServerManager();
def mailServer = ComponentAccessor.getMailServerManager().getDefaultSMTPMailServer();
//if (mailServer) {
try{
Email email = new Email(emailAddr)
email.setMimeType("text/html")
email.setSubject(subject)
email.setBody(body)
mailServer.send(email)
log.debug("Mail sent")
}
catch(Exception e) {
log.warn("Please make sure that a valid mailServer is configured")
log.warn e;
}
}
In additional, I want to remove the beggining od the mail "[Jira]".
How can I do it?
Thank you,
Daniel
The Email class has setFrom() and setFromName() methods.
https://docs.atlassian.com/atlassian-mail/1.3.23/com/atlassian/mail/Email.html
You can remove the [Jira] prefix from ALL outbound email messages by going into the Outgoing Mail settings page, but I don't know that you can remove it for specific messages in a script.
Hello @Dan27
For the prefix [JIRA], you can remove it by setting the prefix to the mail server
mailServer.SetPrefix("")
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.