{"record":{"id":"c935c8573f5b28fe","repo":"flowable/flowable-engine","slug":"msg","errorCode":null,"errorMessage":"msg","messagePattern":"msg","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/mail/BaseMailActivityDelegate.java","lineNumber":251,"sourceCode":"        return file != null && file.exists() && file.isFile() && file.canRead();\n    }\n\n    protected Expression getExpression(V variableContainer, Expression var) {\n        String variable = (String) variableContainer.getVariable(var.getExpressionText());\n        return createExpression(variable);\n    }\n\n    protected void handleException(V variableContainer, String msg, FlowableException e) {\n        boolean doIgnoreException = Boolean.parseBoolean(getStringFromField(ignoreException, variableContainer));\n        if (doIgnoreException) {\n            logger.info(\"Ignoring email send error: {}\", msg, e);\n            String exceptionVariable = getStringFromField(exceptionVariableName, variableContainer);\n            if (exceptionVariable != null && exceptionVariable.length() > 0) {\n                variableContainer.setVariable(exceptionVariable, msg);\n            }\n        } else {\n            if (e instanceof FlowableMailException) {\n                throw new FlowableException(msg, e);\n            } else {\n                throw e;\n            }\n        }\n    }\n\n    public static class ContentItemDataSourceWrapper implements DataSource {\n\n        protected final ContentItem contentItem;\n        protected final ContentService contentService;\n\n        public ContentItemDataSourceWrapper(ContentItem contentItem, ContentService contentService) {\n            this.contentItem = contentItem;\n            this.contentService = contentService;\n        }\n\n        @Override\n        public InputStream getInputStream() throws IOException {","sourceCodeStart":233,"sourceCodeEnd":269,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/mail/BaseMailActivityDelegate.java#L233-L269","documentation":"When sending the mail fails and no exceptionVariableName field is configured, handleException wraps the failure in a FlowableException whose message is the underlying mail failure message ('msg'). The original exception is attached as the cause if it was a FlowableMailException; otherwise it is rethrown as-is. This is the generic wrapping point for mail send failures.","triggerScenarios":"Any mail send failure (SMTP connection failure, authentication error, bad address, TLS problem) occurring in prepareAndExecuteRequest when the mail activity does not define an 'exceptionVariableName' field to capture errors into a variable.","commonSituations":"SMTP server unreachable/wrong host-port, bad credentials, refused relay, invalid recipient addresses; misconfigured mailServer settings in the engine configuration.","solutions":["Inspect the cause of the FlowableException for the real SMTP error (connection refused, auth failed, etc.)","Verify mailServer configuration (host, port, username, password, useTLS) in the engine configuration","Optionally set the 'exceptionVariableName' field on the mail task to capture failures into a process variable instead of throwing"],"exampleFix":"// before (engine config missing mail server)\nprocessEngineConfiguration.setMailServerHost(null);\n// after\nprocessEngineConfiguration.setMailServerHost(\"smtp.example.com\");\nprocessEngineConfiguration.setMailServerPort(587);\nprocessEngineConfiguration.setMailServerUseTLS(true);","handlingStrategy":"try-catch","validationCode":"// verify SMTP reachability/config before sending\nInetAddress.getByName(mailServerHost); // throws if host unresolvable","typeGuard":null,"tryCatchPattern":"try {\n    // execute mail task\n} catch (FlowableException e) {\n    Throwable cause = e.getCause();\n    log.error(\"Mail send failed: {} cause: {}\", e.getMessage(), cause, cause);\n    // inspect cause: SMTPAddressFailedException, AuthenticationFailedException, etc.\n}","preventionTips":["Set exceptionVariableName on mail tasks to capture failures in-process","Verify mailServer host/port/credentials/TLS settings in engine config","Catch and inspect getCause() for the underlying SMTP error"],"tags":["email","smtp","wrapped-exception"],"backgroundTag":"smtp-send-failed","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}