Bonita SMTP Connector - how to trap an error when invalid email address?

1
0
-1

Hello,

Looking for a help in this issue:

I have a process with email notification by SMTP connector.

Email address to send the notification should be provided by a user (some basic validation is already done with the form/javascript).

I want to notify my user if the address is incorrect.

When I set a boundary event error trap ("if connector fails... Throw error event") and setup special service task to process the error (notify a user that the address may be invalid), I don't get it.. because there is no error reported from Bonita Engine point of view even if the email address is incorrect (email addres syntax is ok, its just about wrong recepient)...

So, any chance to capture SMTP server responce to recognize if the email recepient's address was wrong?

Thanks !

1 answer

1
0
-1
This one is the BEST answer!

Hi,

Here there is the connector source code

https://github.com/bonitasoft/bonita-connector-email/blob/master/src/main/java/org/bonitasoft/connectors/email/EmailConnector.java

If in line 486, Transport.send(email); we got an error, this one will set the connector in failed state, but based on this https://javaee.github.io/javamail/FAQ#badaddr I do not think an exception will be triggered

Cheers

Notifications