MailBee. NET Objects Tutorials

Sending e-mails without SMTP server

Besides sending via an SMTP relay server, there is a feature to use the so-called “direct send” mode. In this case, you don't need to specify any relay server. For each unique domain in the list of message recipients' domains (e.g. domain1, domain2, domain3 if the recipients are joe@domain3, kate@domain1, bill@domain2, tanya@domain3, rob@domain2), the component makes a query to the DNS server to get the name of the SMTP server which accepts e-mails for the corresponding domain (e.g. mx.domain1, smtp.domain2, mx-5.large-isp for domain3), and then sends mail directly to these servers. If more than one SMTP server accepts mail for the given domain, the highest-priority server will be tried first. If it fails, other servers will be tried accordingly to their priorities.

If multiple DNS servers are specified, MailBee will distribute the load between the available DNS servers to improve the performance. However, if some DNS servers have lower priority than the others, they will not be tried unless the primary servers fail. This allows the developers to implement high-performance and reliable send mail systems. Since the direct send operation is often used by spammers, many mail services do not accept mail submissions from unknown hosts. It is recommended to perform direct sending from the domain which has at least one MX record assigned. In this case, the recipients hosts will be able to verify the sender’s domain and accept the message submission request.

MailBee.NET Objects allows automatic search of the available DNS servers using the SMTP.DnsServers.Autodetect method as follows:

C#

oMailer.DnsServers.Autodetect();

VB.NET

oMailer.DnsServers.Autodetect()

You can also add a DNS server to the collection by its IP address using SMTP.DnsServers.Add method as follows:

C#

oMailer.DnsServers.Add("127.0.0.1");

VB.NET

oMailer.DnsServers.Add("127.0.0.1")

Or if you want to assign certain priority to avoid distributing the load between multiple DNS server. In this case, lower-priority server will only be used if the higher-priority server fails:

C#

oMailer.DnsServers.Add("127.0.0.1", 0);

VB.NET

oMailer.DnsServers.Add("127.0.0.1", 1)

The highest priority level is 0.