public RblStatusCollection GetRblStatusesOfMailOriginatingIPAddress( MailMessage msg, int receivedIndex, string rblHosts )
Public Function GetRblStatusesOfMailOriginatingIPAddress ( msg As MailMessage, receivedIndex As Integer, rblHosts As String() ) As RblStatusCollection
|MailBeeInvalidArgumentException||msg is a null reference (Nothing in Visual Basic), or rblHosts is a null reference or contains at least one value which is a null reference or an empty string, or receivedIndex is negative or does not denote a valid index in msg's TimeStamps collection.|
|MailBeeException||Another error occurred (e.g. timeout from DNS server) for all RBLs in the list.|
This method extracts the originating IPv4 address from Received header and then uses GetRblStatusesOfIPAddress(String, String) method to get the statuses of this IP address in the specified RBLs.
Usually, the most recent Received header must be examined (receivedIndex must be zero). However, in case if mail flow in your network is more complex (e.g. all mail is forwarded through some gateway), you may need to analyze not the most recent Received but next to it. In this case, receivedIndex must be 1.
The header may look like Received: from [126.96.36.199] (helo=zebra.domain.com) by mx.afterlogic.com with esmtp (Exim 4.85) id 1ctx6r-119Hei-S8 for firstname.lastname@example.org; Fri, 31 Mar 2017 07:01:03 -0700.
In the above, 188.8.131.52 denotes the originating IP address.
This method supports multi-threading to check multiple RBLs at once. To enable multi-threading, set MaxThreadCount to -1.
For each RBL, its own status is set. Unlike Boolean-returning methods like IsMailOriginatingIPAddressInRbl(MailMessage, Int32, String), this method provides more extensive info for an IP address. In particular, RblReplyText property of each RblStatus object in the resulting collection may contain the exact reason of the IP addresses being blacklisted. You need to refer to the documentation of the corresponding RBL to find out how to treat the return codes.
For instance, return codes of the popular Spamhaus Zen RBL can be found at https://www.spamhaus.org/zen/.