SmtpIsSmtpContext Property |
Namespace: MailBee.SmtpMail
The Smtp component can operate in multi-thread mode, and is capable of establishing non-SMTP connections (while performing DNS MX lookup or POP-before-SMTP authentication). However, many Smtp class methods make sense only when a single SMTP connection is used at the moment. In this case, IsSmtpContext property can be used to make sure a call of such a method is possible.
If multi-threading, DNS MX lookup and POP-before-SMTP authentication are not used, this property will always return true. By default, multi-threading is not used (MaxThreadCount is 1), and automatic POP-before-SMTP authentication is off (AuthPopBeforeSmtp is false).
DNS MX lookup can be performed in direct send mode, when the message is being sent using mail send method like Send or RelayFromEmlFile(String, String, EmailAddressCollection) without prior Connect method call (and no SMTP servers were available in SmtpServers collections, or they had lower priority than the servers in DnsServers collection). If the connection was established by calling Connect method, DNS MX lookup will never be used.
The following are examples of methods which can only be used only if IsSmtpContext is true:
If the component was used in multiple-connections mode (for instance, the message was sent using MX lookup), the developer can revert it back to default mode using ResetState method.