i have created a servlet plugin for jira, and want to send mail in this servlet. it works ok in my local server, when i deployed it to our integration server, it doesn't work, the integration server have configed the mail server and enabled. anyone can give me a suggestion? the code as below:
SMTPMailServer mailServer = ComponentAccessor.getMailServerManager().getDefaultSMTPMailServer();
if (mailServer == null)
{
LOG.debug("Not sending message as the default SMTP Mail Server is not defined.");
return;
}
if (!MailFactory.getSettings().isSendingDisabled())
{
Email mail = new Email(to);
mail.setSubject(subject);
Multipart mainPart = new MimeMultipart();
MimeBodyPart messageBodyPart = new MimeBodyPart();//创建一个包含HTML内容的MimeBodyPart
//设置HTML内容
messageBodyPart.setContent(body,"text/html; charset=utf-8");
mainPart.addBodyPart(messageBodyPart);
mail.setMultipart(mainPart);
mailServer.send(mail);
}
else
{
LOG.debug("Not sending message as sending is turned off.");
}