SmtpGetPtrData Method
Retrieves the list of domain names for the specified IP address.

Namespace: MailBee.SmtpMail
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.4 build 677 for .NET 4.5
Syntax
public string[] GetPtrData(
	string ipString
)

Parameters

ipString
Type: SystemString
The IP address string.

Return Value

Type: String
The array of strings taken from DNS PTR data for the specified IP address, or a null reference (Nothing in Visual Basic) if an error occurred or no PTR record found for the given domain.
Exceptions
ExceptionCondition
MailBeeInvalidArgumentExceptionipString is a null reference (Nothing in Visual Basic).
MailBeeExceptionAn error occurred and ThrowExceptions is true.
Remarks

This method makes DNS PTR query (reverse DNS query) to the servers listed in DnsServers collection regarding ipString address.

Popular anti-spam check is making reverse DNS query for the IP address from which the mail message was sent. Then, the retured domain name is compared with the domain name from "From:" or "Return-Path:" address to make sure it was really sent from that domain.

Note Note
If the IP address has multiple domain names associated with it, PTR record will usually return only the domain name taken from A record. Other domain names are aliases (CNAMEs). They will not be returned as their information is not contained in PTR records.
Examples
This sample retrieves domain names associated with an IP address. Make sure to specify real IP address prior to running this sample.
using System;
using MailBee;
using MailBee.SmtpMail;

class Sample
{
    static void Main(string[] args)
    {
        Smtp mailer = new Smtp();
        mailer.DnsServers.Autodetect();
        string[] domains = mailer.GetPtrData("123.123.123.123");
        foreach (string domain in domains)
        {
            Console.WriteLine(domain);
        }
    }
}
See Also