How to get SMTP status code after sending e-mail

Let’s say we have receiver email address “kjdhfsdhfdsfdsjf@gmail.com”.

Main goal: check if email address exists and if it does, send message XYZ.

My idea: check SMTP status code. I know that “550” is status of “Mailbox Unavailable”.

Problem: How to check in UiPath if mail sent to “kjdhfsdhfdsfdsjf@gmail.com” gives SMTP status code 550? The best solution would be a function which has input parameter emailAddress and returns status code.

Is there possibility to reach my main goal without sending XYZ message and after few seconds checking inbox if there is a message about sending failure?

@kbuszta

Will enclosing the Send SMTP Mail message activity within a try catch block and having the Catch handle the SmtpException help?

Send SMTP Mail message activity doesn’t throw error if structure of email address is correct.
In my example address email(kjdhfsdhfdsfdsjf@gmail.com) is valid, but doesn’t exists.