flowable/flowable-engine · error · FlowableMailException

Sending the email to the following server failed :

Error message

Sending the email to the following server failed : 

What it means

Flowable throws FlowableMailException when Jakarta Mail's Transport.send fails to deliver an email to the configured SMTP server. The library catches the underlying MessagingException and enriches it with the SMTP host:port read from the mail session properties, so the developer can see which server rejected or could not be reached. The root cause (auth failure, unknown host, TLS problem, etc.) is preserved as the cause.

Solutions

  1. Read the chained cause (e.getCause()) for the real SMTP failure reason
  2. Verify mail.smtp.host and mail.smtp.port values in the Flowable mail server configuration
  3. Test connectivity to the SMTP host/port with telnet or openssl s_client from the same machine
  4. If the server requires TLS, set mail.smtp.starttls.enable=true or use the SSL port variant
  5. Check SMTP credentials and From address validity

Example fix

// before
mailServer.setHost("smtp.example.com");
mailServer.setPort(25);
// after
mailServer.setHost("smtp.example.com");
mailServer.setPort(587);
mailServer.setUseTls(true);
mailServer.setUsername("user@example.com");
mailServer.setPassword("secret");
Defensive patterns

Strategy: try-catch

Validate before calling

// before sending
InetAddress addr = InetAddress.getByName(mailServer.getHost()); // fails fast on unknown host
try (Socket s = new Socket()) { s.connect(new InetSocketAddress(addr, mailServer.getPort()), 5000); } // port reachable

Try / catch

try {
    mailClient.send(mail);
} catch (FlowableMailException e) {
    logger.error("SMTP send to {} failed: {}", e.getCause() != null ? e.getCause().getMessage() : e.getMessage(), e);
    throw new MailDeliveryException("email delivery failed", e);
}

Prevention

When it happens

Trigger: Any call to send() via JakartaMailFlowableMailClient where Transport.send(message) throws a MessagingException: SMTP server unreachable, wrong host/port, authentication rejected, TLS handshake failure, or message rejected by the server.

Common situations: Wrong mail.smtp.host or mail.smtp.port in the mail server configuration; SMTP server requires STARTTLS/SSL but is not configured; invalid username/password; corporate firewall blocking outbound port 25/465/587; mail server rejecting the From address or recipient.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/5422e994e61e1191. Report an issue: GitHub.

Appendix: source

Thrown at modules/flowable-mail/src/main/java/org/flowable/mail/common/impl/jakarta/mail/JakartaMailFlowableMailClient.java:446

    protected static class JakartaMailSendMailRequest implements ExecutableSendMailRequest {

        protected final MimeMessage message;

        protected JakartaMailSendMailRequest(MimeMessage message) {
            this.message = message;
        }

        @Override
        public MailResponse send() {
            try {
                Transport.send(message);
                return new SimpleMailResponse(message.getMessageID());
            } catch (MessagingException e) {
                Session session = message.getSession();
                String host = session.getProperty("mail.smtp.host");
                String port = session.getProperty("mail.smtp.port");
                throw new FlowableMailException("Sending the email to the following server failed : " + host + ":" + port, e);
            }
        }
    }
}

View on GitHub (pinned to d6d39ce1c6)