Retrieves the list of domain names for the specified IP address.
Namespace: MailBee.SmtpMailAssembly: MailBee.NET (in MailBee.NET.dll) Version: 12.4 build 677 for .NET 4.5
Syntax public string[] GetPtrData(
string ipString
)
Public Function GetPtrData (
ipString As String
) As String()
Parameters
- ipString
- Type: SystemString
The IP address string.
Return Value
Type:
StringThe 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 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 |
---|
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);
}
}
}
Imports System
Imports MailBee
Imports MailBee.SmtpMail
Class Sample
Shared Sub Main(ByVal args() As String)
Dim mailer As Smtp = New Smtp
mailer.DnsServers.Autodetect()
Dim domains() As String = mailer.GetPtrData("123.123.123.123")
Dim domain As String
For Each domain In domains
Console.WriteLine(domain)
Next
End Sub
End Class
See Also