title: Could not connect to SMTP host
body: <blockquote>
  <p>SMTP Error: Could not connect to SMTP host. Message could not be sent.</p>
  <p>Mailer Error: SMTP Error: Could not connect to SMTP host.</p>
  </blockquote>
  <p>I can't seem to find a way to make PHPMailer work under CentOS. Mail work just fine under Windows with XAMPP but I always get this error under Linux.</p>
  <p>The SMTP server is a Lotus Domino listening on port 25, CentOS machine has NO firewall at all and the strange thing is that even mail() does not work. It returns nothing (while on Windows returns 1). If I send an email through telnet via CentOS server it works just fine so I don't think it is a network problem. It must be related to PHP but I don't know how.</p>
  <pre><code>&lt;?php
  require(&quot;class.phpmailer.php&quot;);
  $mail = new PHPMailer();
  $mail-&gt;IsSMTP();
  $mail-&gt;Host = &quot;192.168.x.x&quot;;
  $mail-&gt;SMTPAuth = false;
  $mail-&gt;From = &quot;xxx@xxx.it&quot;;
  $mail-&gt;FromName = &quot;XXX&quot;;
  $mail-&gt;AddAddress(&quot;xxx@xxx.it&quot;);
  $mail-&gt;IsHTML(true);
  $mail-&gt;Subject = &quot;Test&quot;;
  $mail-&gt;Body    = &quot;Test&quot;;
  if(!$mail-&gt;Send())
  {
     echo &quot;Message could not be sent. &lt;p&gt;&quot;;
     echo &quot;Mailer Error: &quot; . $mail-&gt;ErrorInfo;
     exit;
  }
  echo &quot;Message has been sent&quot;;
  ?&gt;
  </code></pre>
  <p>Just to clarify the code above works on XAMPP (Windows).</p>
  <p>I debugged the error on PHPMailer and error happens here (class.smtp.php method Connect()):</p>
  <pre><code>$this-&gt;smtp_conn = @fsockopen($host,    // the host of the server
                               $port,    // the port to use
                               $errno,   // error number if any
                               $errstr,  // error message if any
                               $tval);   // give up after ? secs
  // verify we connected properly
  if(empty($this-&gt;smtp_conn)) {
    $this-&gt;error = array(&quot;error&quot; =&gt; &quot;Failed to connect to server&quot;,
                         &quot;errno&quot; =&gt; $errno,
                         &quot;errstr&quot; =&gt; $errstr);
    if($this-&gt;do_debug &gt;= 1) {
      echo &quot;SMTP -&gt; ERROR: &quot; . $this-&gt;error[&quot;error&quot;] . &quot;: $errstr ($errno)&quot; . $this-&gt;CRLF . '&lt;br /&gt;';
    }
    return false;
  }
  </code></pre>
  <p>It looks like it can't open the Socket...</p>
  <p><strong>UPDATE:</strong> Using $mail-&gt;SMTPDebug  = 2; as suggested by Alvaro produced this output:</p>
  <blockquote>
  <p>SMTP -&gt; ERROR: Failed to connect to server: Permission denied (13)</p>
  </blockquote>