Good day,
I'm trying to create a working script to send a notification when a label is added to a page.
Here is script:
import com.atlassian.sal.api.component.ComponentLocator
import com.atlassian.mail.Email;
import com.atlassian.mail.server.SMTPMailServer;
import com.atlassian.confluence.mail.ConfluenceMailServerManager
import com.atlassian.confluence.event.events.content.page.PageEvent
def confluenceMailServerManager = ComponentLocator.getComponent(ConfluenceMailServerManager)
SMTPMailServer mailServer = confluenceMailServerManager.getDefaultSMTPMailServer();
if (mailServer) {
Email email = new Email("mail@domain.com");
email.setSubject("test");
email.setBody("test");
mailServer.send(email);
} else {
throw new RuntimeException("no mail server!!!");
}
Tell me how to add a page and link, as well as the name of the label and the user who added the label to the email template.
Hope you help,