--- a/lib/phpmailer/class.phpmailer.php
+++ b/lib/phpmailer/class.phpmailer.php
@@ -548,8 +548,11 @@ class PHPMailer
         // Retry while there is no connection
         while($index < count($hosts) && $connection == false)
         {
-            if(strstr($hosts[$index], ":"))
-                list($host, $port) = explode(":", $hosts[$index]);
+            $hostinfo = array();
+            if (preg_match('/^(.+):([0-9]+)$/', $hosts[$index], $hostinfo)) {
+                $host = $hostinfo[1];
+                $port = $hostinfo[2];
+            }
             else
             {
                 $host = $hosts[$index];
