Send a message without SMTP server
The simplest way to send a message is to use QuickSend method of Smtp class (this method is static, it does not require you to create an instance of Smtp class).
QuickSend method allows you to send e-mails out even if you do not have an SMTP relay server. The method determines which servers accept mail for the domains specified in To/CC/BCC fields of the e-mail by making queries to the DNS servers registered in the network settings and then sends the e-mail to the recipients' mail servers directly.
MailBee.SmtpMail.Smtp.QuickSend("firstname.lastname@example.org", "email@example.com", "Subject", "Message Body");
MailBee.SmtpMail.Smtp.QuickSend("firstname.lastname@example.org", "email@example.com", "Subject", "Message Body")
If you would like to specify DNS servers for DNX MX lookup manually, you can edit app.config or web.config file of your application and place MailBee.DnsMX.DnsServerCollection key there. See DnsAutodetectOptions documentation for details.
The alternate way is to create Smtp object and specify IP addresses of DNS servers manually:
To populate DnsServers automatically by examining the system properties, use Autodetect method (by the way, QuickSend method internally uses Autodetect for determining the list of available DNS servers):
Moreover, you can specify options for tuning the automatic detection of the DNS servers registered in the system. See DnsAutodetectOptions documentation for details.
Note: since direct send operation is often used by spammers, many mail services do not accept mail submissions from unknown hosts. It's recommended to perform direct sending only from domains which have the appropriate MX, PTR and SPF records assigned. In this case, the hosts receiving mail from your host will be able to verify the sender’s domain and accept the message submission request.