SmtpHello Method
Sends initial greeting to the SMTP server.

Namespace: MailBee.SmtpMail
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 11.2.0 build 590 for .NET 4.5
Syntax
public bool Hello()

Return Value

Type: Boolean
true if the method succeeds; otherwise, false.
Exceptions
ExceptionCondition
MailBeeExceptionAn error occurred and ThrowExceptions is true.
Remarks

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).

If the application knows the server it uses does not support ESMTP, it can disable EHLO (so that HELO will be used) by setting SmtpOptions to ClassicSmtpMode.

Examples
This sample connects to the SMTP server, sends greeting, and prints the response received form the server into console.
// 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();
See Also