Page 1 of 1

Get status code of error message

Posted: 2019-05-05 04:01
by cblaze22
Is there a strongly typed way to get the status code of a bounced email from?

Code: Select all

   Sub OnDeliveryFailed(oMessage, sRecipient, sErrorMessage)
I know I can parse the message below but thought there was an easier way. Also if I had to parse the string what is [nl]?
"Error Type: SMTP[nl] Remote server (35.173.65.153) issued an error.[nl] hMailServer sent: [nl] Remote server replied: 421 spr-ibgw-5001a.stratus.cloudmark.com cmsmtp SMTP server not available AUP#1330[nl]"

Re: Get status code of error message

Posted: 2019-05-05 04:13
by mattg
nl = New Line


OnDeliveryFailed is only for incoming messages that accepted by hMailserver

It fires for me ONLY when a global rule deletes a message

Re: Get status code of error message

Posted: 2019-05-05 05:03
by cblaze22
Sorry I am not following these comments
OnDeliveryFailed is only for incoming messages that accepted by hMailserver

It fires for me ONLY when a global rule deletes a message

Re: Get status code of error message

Posted: 2019-05-05 09:08
by mattg
OnDeliveryFailed (the sub you referenced) is only for mail being sent to your hmailserver, it is not for messages that get bounced by other servers.

I suspect that you are wanting to track messages that are bounced by other servers.
The ONLY way that you can do is by parsing the log files

Re: Get status code of error message

Posted: 2019-05-05 15:35
by cblaze22
Are you sure about this?

We received this message below in our logs from that method. That seems like a message from a delivery fail?

Code: Select all

"Error Type: SMTP[nl] Remote server (35.173.65.153) issued an error.[nl] hMailServer sent: [nl] Remote server replied: 421 spr-ibgw-5001a.stratus.cloudmark.com cmsmtp SMTP server not available AUP#1330[nl]"

Re: Get status code of error message

Posted: 2019-05-06 02:05
by mattg
How do you know that it came from that method?

Re: Get status code of error message

Posted: 2019-05-06 02:55
by cblaze22
Cause I wrote it?????????

Code: Select all

   Sub OnDeliveryFailed(oMessage, sRecipient, sErrorMessage)
EventLog.Write(sErrorMessage)
   End Sub

Re: Get status code of error message

Posted: 2019-05-06 03:33
by mattg
You are correct

I just forced the same message to fail, and it did log for me too. I obviously don't have many failures, I couldn't find one so far this month when I looked earlier.

Mine logged

Code: Select all

2019-05-06 11:28:47.371  OnDeliveryFailed:- test   matt@example.com   sdsfjkld@jhfjksfyjdsyjhg.com   Error Type: SMTP
   Error Description: No mail servers appear to exists for the recipient's address.
   Additional information: Please check that you have not misspelled the recipient's email address.