aspNetEmail

DirectSend.DnsServers Property

The IPAddresses of DNS servers to use for MX record lookup.

public static System.Net.IPAddress[] DnsServers {get; set;}

Example

[C#]
            EmailMessage m = new EmailMessage();
            m.From = "john@example.com";
            m.To = "you@yourcompany.com";
            m.Subject = "example email";
            m.Body = "your body contents go here...";
            //logging on the EmailMessage object will be used by the DirectSend class
            m.LogPath = "c:\\email.log";
            m.Logging = true;
            
            //set the dns server to use for lookup
            IPAddress[] dnsServers = new IPAddress[ 1 ];
            dnsServers[ 0 ] = IPAddress.Parse( "10.0.96.1" );
            
            DirectSend.DnsServers = dnsServers;
            DirectSend.Send( m );
            
            
[VB.NET]
            
            Dim m As New EmailMessage()
            m.From = "john@example.com"
            m.To = "you@yourcompany.com"
            m.Subject = "example email"
            m.Body = "your body contents go here..."
            'logging on the EmailMessage object will be used by the DirectSend class
            m.LogPath = "c:\email.log"
            m.Logging = True
            
            'set the dns server to use for lookup
            Dim dnsServers(1) As IPAddress
            dnsServers(0) = IPAddress.Parse("10.0.96.1") '
            DirectSend.DnsServers = dnsServers
            DirectSend.Send(m)
            
            

See Also

DirectSend Class | aspNetEmail Namespace