Sends EHLO or HELO command to the server. This command must be issued immediately after the connection was established.
EHLO/HELO command has a parameter which should the domain name of the host which will send mail. By default, MailBee uses either the IPv4 address of the current machine or the local host name if IPv4 address is not available. Usually, this behavior does not need to be changed. However, if the application logic requires the default behavior to be overridden, the developer can force any arbitrary string to be used as a parameter of HELO/EHLO command by setting HelloDomain property of the server which is already in SmtpServers collection, or by using Add(SmtpServer) method to add new server into the collection.
By default, the component sends EHLO command, which is an extended version of HELO command. An ESMTP-enabled server returns the list of server capabilities in reply to EHLO command. However, if the server does not support any ESMTP extensions, it will return an error. In this case, the component will try HELO command. However, the list of the server capabilities will not be available, and GetExtensions will return a null reference (Nothing in Visual Basic).
// To use the code below, import these namespaces at the top of your code. using System; using MailBee; using MailBee.SmtpMail; // The actual code (put it into a method of your class) Smtp mailer = new Smtp(); mailer.SmtpServers.Add("smtp.domain.com"); mailer.Connect(); mailer.Hello(); Console.WriteLine(mailer.GetServerResponse()); mailer.Disconnect();
' To use the code below, import MailBee namespaces at the top of your code. Imports MailBee Imports MailBee.SmtpMail ' The actual code (put it into a method of your class) Dim mailer As New Smtp mailer.SmtpServers.Add("smtp.domain.com") mailer.Connect() mailer.Hello() Console.WriteLine(mailer.GetServerResponse()) mailer.Disconnect()