SmtpGetTxtData Method
Retrieves the list of TXT strings of DNS data of the specified domain.

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

Parameters

domain
Type: SystemString
The domain to get the list of MX hosts for.

Return Value

Type: String
The 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
ExceptionCondition
MailBeeInvalidArgumentExceptiondomain is a null reference (Nothing in Visual Basic).
MailBeeExceptionAn error occurred and ThrowExceptions is true.
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);
        }
    }
}
See Also