MailBee. NET Objects Tutorials

Sending e-mails without SMTP server

Besides sending to SMTP relay server, there is an opportunity to use the so-called “direct send” mode. In this case, the developer does not need to specify any SMTP server. Instead of this, the developer specifies the DNS server having at least one MX record assigned. For each unique domain in the list of message recipients domains (e.g. host1, host2, host3 if the recipients are joe@host3, kate@host1, bill@host2, tanya@host3, rob@host2), 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.host1, smtp.host2, mx-5.large-isp for host1, host2, host3), 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 the unknown hosts. It is recommended to perform direct sending from the domain which has at least one MX record assigned. In this case, the hosts which are communicating with the application will be able to verify the sender’s domain and accept the message submission request.

Moreover, 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()

Besides, the developer can add a new DNS server to the collection by IP-address using the SMTP.DnsServers.Add method as follows:

C#

oMailer.DnsServers.Add("127.0.0.1");

VB.NET

oMailer.DnsServers.Add("127.0.0.1")

Besides, the developer can specify the priority of the new DNS server as the second parameter when calling the SMTP.DnsServers.Add method as shown below:

C#

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

VB.NET

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

Please note that the highest priority level is marked as 0.