diff --git a/interface/lib/classes/ispcmail.inc.php b/interface/lib/classes/ispcmail.inc.php
index f5aa35957753ec1c6ff65d6a9eb555cff747065e..17ab0eb300eb403bfb0f8eca3ba4f2d02a0b680d 100644
--- a/interface/lib/classes/ispcmail.inc.php
+++ b/interface/lib/classes/ispcmail.inc.php
@@ -169,7 +169,7 @@ class ispcmail {
 			$this->smtp_host = $value;
 			break;
 		case 'smtp_port':
-			if(intval($value) > 0) $this->smtp_port = $value;
+			if(intval($value) > 0) $this->smtp_port = intval($value);
 			break;
 		case 'smtp_user':
 			$this->smtp_user = $value;
@@ -585,7 +585,7 @@ class ispcmail {
 	 * @access private
 	 */
 	private function _smtp_login() {
-		$this->_smtp_conn = fsockopen(($this->smtp_crypt == 'ssl' ? 'tls://' : '') . $this->smtp_host, $this->smtp_port, $errno, $errstr, 30);
+		$this->_smtp_conn = fsockopen(($this->smtp_crypt == 'ssl' ? 'tls://' : '') . $this->smtp_host, (int)$this->smtp_port, $errno, $errstr, 30);
 		if(empty($this->_smtp_conn)) return false;
 		$response = fgets($this->_smtp_conn, 515);