void SMTPClientConnection::ProtocolEHLOSent_(int code, const AnsiString &request) { if (!IsPositiveCompletion(code)) { bool ehlo_required = GetConnectionSecurity() == CSSTARTTLSRequired || use_smtpauth_; if (ehlo_required) { // hMailServer is configured to require EHLO, but the remote server does not support it. UpdateAllRecipientsWithError_(500, "Server does not support EHLO command.", false); SendQUIT_(); } else { // Server does not support EHLO, but we do not require it. Switch to HELO. String computer_name = Utilities::ComputerName(); EnqueueWrite_("HELO " + computer_name); SetState_(HELOSENT); } return; } if (GetConnectionSecurity() == CSSTARTTLSRequired || GetConnectionSecurity() == CSSTARTTLSOptional) { if (!IsSSLConnection()) { if (request.Contains("STARTTLS")) { EnqueueWrite_("STARTTLS"); SetState_(STARTTLSSENT); return; } else { // Remote server does not support STARTTLS if (GetConnectionSecurity() == CSSTARTTLSRequired) { UpdateAllRecipientsWithError_(500, "Server does not support STARTTLS.", false); SendQUIT_(); return; } } } } if (use_smtpauth_) { // Ask the server to initiate login process. EnqueueWrite_("AUTH LOGIN"); SetState_(AUTHLOGINSENT); } else { ProtocolSendMailFrom_(); } }