Retrieves the list of TXT strings of DNS data of the specified domain.
Namespace: MailBee.SmtpMailAssembly: MailBee.NET (in MailBee.NET.dll) Version: 12.5.0 build 687 for .NET 4.5
Syntax public string[] GetTxtData(
string domain
)
Public Function GetTxtData (
domain As String
) As String()
Parameters
- domain
- Type: SystemString
The domain to get the list of MX hosts for.
Return Value
Type:
StringThe array of strings taken from DNS TXT data of the specified domain,
or a null reference (
Nothing in Visual Basic) if an error occurred or no TXT record found for the given domain.
Exceptions Remarks This method makes DNS TXT query to the servers listed in DnsServers collection regarding
domain. The method supports multiple strings per TXT record and multiple TXT records per domain.
If multiple TXT records are returned, their arrays of strings are concatenated into single array.
TXT records contain important DNS information used by various antispam techniques like SPF and DomainKeys (DKIM).
Examples
This sample retrieves TXT information for "gmail.com" domain.
using System;
using MailBee;
using MailBee.SmtpMail;
class Sample
{
static void Main(string[] args)
{
Smtp mailer = new Smtp();
mailer.DnsServers.Autodetect();
string[] strings = mailer.GetTxtData("gmail.com");
foreach (string str in strings)
{
Console.WriteLine(str);
}
}
}
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 strings() As String = mailer.GetTxtData("gmail.com")
Dim str As String
For Each str In strings
Console.WriteLine(str)
Next
End Sub
End Class
See Also