diff --git a/interface/lib/classes/ispcmail.inc.php b/interface/lib/classes/ispcmail.inc.php
index 308d9dfd2d552e8244caee6731e959976612a3ad..930aabbca94591bbeb7214f0b9a0bbf095d030ec 100644
--- a/interface/lib/classes/ispcmail.inc.php
+++ b/interface/lib/classes/ispcmail.inc.php
@@ -593,6 +593,11 @@ class ispcmail {
 		$response = fgets($this->_smtp_conn, 515);
 		if(empty($this->_smtp_conn)) return false;
 
+		//Say Hello to SMTP
+		if($this->smtp_helo == '') $this->detectHelo();
+		fputs($this->_smtp_conn, 'HELO ' . $this->smtp_helo . $this->_crlf);
+		$response = fgets($this->_smtp_conn, 515);
+
 		// ENCRYPTED?
 		if($this->smtp_crypt == 'tls') {
 			fputs($this->_smtp_conn, 'STARTTLS' . $this->_crlf);
@@ -600,11 +605,6 @@ class ispcmail {
 			stream_socket_enable_crypto($this->_smtp_conn, true, STREAM_CRYPTO_METHOD_TLS_CLIENT);
 		}
 
-		//Say Hello to SMTP
-		if($this->smtp_helo == '') $this->detectHelo();
-		fputs($this->_smtp_conn, 'HELO ' . $this->smtp_helo . $this->_crlf);
-		$response = fgets($this->_smtp_conn, 515);
-
 		//AUTH LOGIN
 		fputs($this->_smtp_conn, 'AUTH LOGIN' . $this->_crlf);
 		$response = fgets($this->_smtp_conn, 515);