title: SMTP Error: Could not connect to SMTP host using PHPMailer
body: <p>we are using SMTP advanced authentication to send a test mail using PHPMailer.
  We are using 1and1.com server with SMTP and SSL for E-mail Exchange.
  We need to run this php page from a third party server. we have taken a example from the downloaded PHPMailer package. we have tried with "test_pop_before_smtp_advanced" example and "  SMTP advanced test with authentication" example. In both cases we are getting same Error.</p>
  
  <blockquote>
    <p>SMTP Error: Could not connect to SMTP host.</p>
  </blockquote>
  
  <p>Here is the php file we have written for sending Mail. </p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;PHPMailer - SMTP advanced test with authentication&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;?php
  echo "hai";
  include('class.phpmailer.php');
  include('class.smtp.php');
  $mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch
  
  
  $mail-&gt;SMTPSecure = "ssl";
  $mail-&gt;SMTPKeepAlive = true;
  $mail-&gt;Mailer = "smtp";
  echo "hai1";
  $mail-&gt;IsSMTP(); // telling the class to use SMTP
  
  try {
  
    $mail-&gt;Host       = "smtp.1and1.com"; // SMTP server
    $mail-&gt;SMTPDebug  = 1;                     // enables SMTP debug information (for testing)
    $mail-&gt;SMTPAuth   = true;                  // enable SMTP authentication
    $mail-&gt;Host       = "smtp.1and1.com"; // sets the SMTP server
    $mail-&gt;Port       = 587;                    // set the SMTP port for the GMAIL server
    $mail-&gt;Username   = "xxx@abc.com"; // SMTP account username
    $mail-&gt;Password   = "xxxxx";        // SMTP account password
    $mail-&gt;AddReplyTo('mno@abc.com', 'First Last');
    $mail-&gt;AddAddress('mno@abc.com', 'John Doe');
    $mail-&gt;SetFrom('xxx@abc.com', 'First Last');
    $mail-&gt;Subject = 'PHPMailer Test Subject via mail(), advanced';
    $mail-&gt;Body = 'hello';
  
   if(!$mail-&gt;Send()) {
     echo "Mailer Error: " . $mail-&gt;ErrorInfo;
   } else {
     echo "Message sent!";
  }
  } catch (phpmailerException $e) {
  echo "error";
    echo $e-&gt;errorMessage(); //Pretty error messages from PHPMailer
  } catch (Exception $e) {
  echo "err";
    echo $e-&gt;getMessage(); //Boring error messages from anything else!
  }
  ?&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Can anyone help us in this regard, please suggest any other easy approach for the same purpose. Thank you...</p>