SMTP Mail Error Handling

Hello,

I have a codeunit to make a notification email and send it through smtp. This CU is called from a batch job every evening, however it is hanging some nights.

I was wondering is there anyway to handle this error to just skip the email if it occurs:

The SMTP mail system returned the following error: (0x8004020F): The server rejected one or more recipient addresses. The server response was: 550 5.1.1 User unknown

Thanks.

Hi, I’ve used something like this code snippet:

Result := Mail.Send(…);

Result is a text datatype and Mail is the ‘Microsoft Navision Mail’.SmtpMessage automation datatype. Then you can do an IF statement that can determine if Result returns a value. If Result returns a value, than raise an error message.

I hope this helps you out