Program: 58775
Project: 58775
Buggy source:
@Transactional(rollbackOn={MessagingException.class,IOException.class,Exception.class}) public Message sendByEmail(Message message) throws MessagingException, IOException {
  MailAccount mailAccount=message.getMailAccount();
  if (mailAccount == null) {
    return message;
  }
  log.debug("String_Node_Str");
  com.axelor.mail.MailAccount account=new SmtpAccount(mailAccount.getHost(),mailAccount.getPort().toString(),mailAccount.getLogin(),mailAccount.getPassword(),mailAccountService.getSmtpSecurity(mailAccount));
  List<String> replytoRecipients=this.getEmailAddresses(message.getReplyToEmailAddressSet()), toRecipients=this.getEmailAddresses(message.getToEmailAddressSet()), ccRecipients=this.getEmailAddresses(message.getCcEmailAddressSet()), bccRecipients=this.getEmailAddresses(message.getBccEmailAddressSet());
  MailSender sender=new MailSender(account);
  MailBuilder mailBuilder=sender.compose();
  mailBuilder.subject(message.getSubject());
  if (message.getFromEmailAddress() != null) {
    log.debug("String_Node_Str",message.getFromEmailAddress().getAddress());
    mailBuilder.from(message.getFromEmailAddress().getAddress());
  }
  if (replytoRecipients != null && !replytoRecipients.isEmpty()) {
    mailBuilder.replyTo(Joiner.on("String_Node_Str").join(toRecipients));
  }
  if (toRecipients != null && !toRecipients.isEmpty()) {
    mailBuilder.to(Joiner.on("String_Node_Str").join(toRecipients));
  }
  if (ccRecipients != null && !ccRecipients.isEmpty()) {
    mailBuilder.cc(Joiner.on("String_Node_Str").join(ccRecipients));
  }
  if (bccRecipients != null && !bccRecipients.isEmpty()) {
    mailBuilder.bcc(Joiner.on("String_Node_Str").join(bccRecipients));
  }
  if (!Strings.isNullOrEmpty(message.getContent())) {
    mailBuilder.html(message.getContent());
  }
  for (  MetaAttachment metaAttachment : getMetaAttachments(message)) {
    MetaFile metaFile=metaAttachment.getMetaFile();
    mailBuilder.attach(metaFile.getFileName(),MetaFiles.getPath(metaFile).toString());
  }
  mailBuilder.send();
  message.setSentByEmail(true);
  message.setStatusSelect(MessageRepository.STATUS_SENT);
  message.setSentDateT(LocalDateTime.now());
  return messageRepo.save(message);
}

Fixed version (ground truth):
@Transactional(rollbackOn={MessagingException.class,IOException.class,Exception.class}) public Message sendByEmail(Message message) throws MessagingException, IOException, AxelorException {
  MailAccount mailAccount=message.getMailAccount();
  if (mailAccount == null) {
    return message;
  }
  log.debug("String_Node_Str");
  com.axelor.mail.MailAccount account=new SmtpAccount(mailAccount.getHost(),mailAccount.getPort().toString(),mailAccount.getLogin(),mailAccount.getPassword(),mailAccountService.getSmtpSecurity(mailAccount));
  List<String> replytoRecipients=this.getEmailAddresses(message.getReplyToEmailAddressSet()), toRecipients=this.getEmailAddresses(message.getToEmailAddressSet()), ccRecipients=this.getEmailAddresses(message.getCcEmailAddressSet()), bccRecipients=this.getEmailAddresses(message.getBccEmailAddressSet());
  MailSender sender=new MailSender(account);
  MailBuilder mailBuilder=sender.compose();
  mailBuilder.subject(message.getSubject());
  if (message.getFromEmailAddress() != null) {
    if (!Strings.isNullOrEmpty(message.getFromEmailAddress().getAddress())) {
      log.debug("String_Node_Str",message.getFromEmailAddress().getAddress());
      mailBuilder.from(message.getFromEmailAddress().getAddress());
    }
 else {
      throw new AxelorException(IExceptionMessage.MESSAGE_7,IException.CONFIGURATION_ERROR);
    }
  }
  if (replytoRecipients != null && !replytoRecipients.isEmpty()) {
    mailBuilder.replyTo(Joiner.on("String_Node_Str").join(replytoRecipients));
  }
  if (toRecipients != null && !toRecipients.isEmpty()) {
    mailBuilder.to(Joiner.on("String_Node_Str").join(toRecipients));
  }
  if (ccRecipients != null && !ccRecipients.isEmpty()) {
    mailBuilder.cc(Joiner.on("String_Node_Str").join(ccRecipients));
  }
  if (bccRecipients != null && !bccRecipients.isEmpty()) {
    mailBuilder.bcc(Joiner.on("String_Node_Str").join(bccRecipients));
  }
  if (!Strings.isNullOrEmpty(message.getContent())) {
    mailBuilder.html(message.getContent());
  }
  for (  MetaAttachment metaAttachment : getMetaAttachments(message)) {
    MetaFile metaFile=metaAttachment.getMetaFile();
    mailBuilder.attach(metaFile.getFileName(),MetaFiles.getPath(metaFile).toString());
  }
  mailBuilder.send();
  message.setSentByEmail(true);
  message.setStatusSelect(MessageRepository.STATUS_SENT);
  message.setSentDateT(LocalDateTime.now());
  message.setSenderUser(AuthUtils.getUser());
  return messageRepo.save(message);
}