AnsweredAssumed Answered

How to catch errors that occurred while sending an email?

Question asked by maxlich on Dec 28, 2018
Latest reply on Jan 15, 2019 by abbask01

Hi all!
I need to send emails, and I use a service task for it:

    <serviceTask id="SendEmail_1" name="Sending a notification by email" activiti:type="mail">
        <activiti:field name="to">
        <activiti:field name="subject">
        <activiti:field name="text">
        <activiti:field name="ignoreException">
        <activiti:field name="charset">


I also need to catch the errors that occur when sending mail. In the user guide, I read that in order to get a description of the error, you need to read from the variables of the process the value of the variable "exceptionVariableName". As you can see above, I added this to the service task, but so far I have not seen that it works. I tried to give him non-existent addresses of recipients, but there was no error. Does it even work? When does it work? Or is there another mechanism for getting error descriptions?

PS I use Activiti 6.0.0.


PSS I tried to add the block below in the 'extensionElements' tag:

        <activiti:field name="exceptionVariableName">

And it also did not help me (for example, if the recipients are not correct).


PSSS I specified the wrong smtp server host (while creating the process configuration bean), and I got the error description (the Java code for receiving it is presented below), but it is uninformative.

    public void logEmailSending(DelegateExecution execution) {
        Object error = execution.getVariable("error");
        if (error != null)
            logger.error("An error occurred while sending the email: " + error);

it almost solved my problem, but, as I wrote above, I would like to be more concrete by mistake, and it still does not catch the error in the recipients addresses