Hello,
I currently have a script that sends an email with no issues:
import com.atlassian.mail.Email;
import com.atlassian.mail.server.MailServerManager;
import com.atlassian.mail.server.SMTPMailServer;
import com.atlassian.jira.ComponentManager;
import com.atlassian.jira.component.ComponentAccessor;
MailServerManager mailServerManager = ComponentAccessor.getMailServerManager()
SMTPMailServer mailServer = mailServerManager.getDefaultSMTPMailServer()
String currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser().displayName
String issue = "JTP-123"
String subject = "Reminder Notification ${issue}"
String emailAddr = "emailadderss"
String body = """<h1>REMINDER</h1>
<p>Hi ${currentUser},<br/><br/>
This is a reminder that ${issue} was last updated 5 business days ago.</p>
"""
if (mailServer) {
Email email = new Email(emailAddr);
email.setSubject(subject);
email.setMimeType("text/html")
email.setBody(body);
mailServer.send(email);
} else {
// Problem getting the mail server from JIRA configuration, log this error
}
What im trying to do is add Bcc to the email that is sending via postfunction.
I can see that there is a method to add the Bcc called setBcc from this Doc.
I've attempted to place the following line into my code - email.setBcc and provide an email address but it keeps throwing an error saying that setBcc does not exist.
Does this work? or is there another way to get around this?
Many thanks,
Pon