title: Sending emails through SMTP with PHPMailer
body: <p>I'm trying to send SMTP e-mails using PHPMailer, but I keep getting this error message, any ideas how to get rid of it?<br />
  I'm trying to connect via SSL on port 465.</p>
  
  <pre><code>SMTP -&gt; FROM SERVER: 
  SMTP -&gt; FROM SERVER: 
  SMTP -&gt; ERROR: EHLO not accepted from server: 
  
  Notice: fputs() [function.fputs]: send of 18 bytes failed with errno=32 Roura přerušena (SIGPIPE) in /home/www/amazonek.cz/subdomains/library/PHPMailer_v5.1/class.smtp.php on line 494
  SMTP -&gt; FROM SERVER: 
  SMTP -&gt; ERROR: HELO not accepted from server: 
  
  Notice: fputs() [function.fputs]: send of 12 bytes failed with errno=32 Roura přerušena (SIGPIPE) in /home/www/amazonek.cz/subdomains/library/PHPMailer_v5.1/class.smtp.php on line 212
  SMTP -&gt; ERROR: AUTH not accepted from server: 
  SMTP Error: Could not authenticate.
  </code></pre>
  
  <p>My code:</p>
  
  <pre><code>  require_once('../library/PHPMailer_v5.1/class.phpmailer.php');
  
          try{
              $mail = new PHPMailer(true);
              $mail-&gt;IsSMTP();
              $mail-&gt;SMTPAuth = true;
              $mail-&gt;Host = SMTP_SERVER;
              $mail-&gt;Port = SMTP_PORT;
              $mail-&gt;Username = SMTP_USERNAME;
              $mail-&gt;Password = SMTP_PASSWORD;
              $mail-&gt;SMTPDebug = 2;
              $mail-&gt;SetFrom(MAIL_ORDERS_ADDRESS, MAIL_ORDERS_NAME);
              $mail-&gt;Subject = 'AMAZONEK.cz - objednávka číslo '.$_SESSION['orderId'];
              $mail-&gt;MsgHTML('&lt;b&gt;Ahoj&lt;/b&gt;');
              $mail-&gt;AddAddress($_SESSION['user']['email'], $_SESSION['user']['name'].' '.$_SESSION['user']['surname']);
              $mail-&gt;AddBCC(MAIL_ORDERS_ADDRESS, MAIL_ORDERS_NAME);
  
              if(!$mail-&gt;Send()) throw new Exception($mail-&gt;ErrorInfo);
          }
          catch(Exception $e){
              echo $e-&gt;getMessage();
          }
  </code></pre>
  
  <p>Constants definition:</p>
  
  <pre><code>define('SMTP_SERVER', 'smtp.ebola.cz');
  define('SMTP_PORT', 465);
  define('SMTP_USERNAME', 'myEmail@myDomain.tld');
  define('SMTP_PASSWORD', '***CENSORED***');
  
  define('MAIL_ORDERS_ADDRESS', 'myEmail@myDomain.tld');
  define('MAIL_ORDERS_NAME', 'My Name');
  </code></pre>
  
  <p>Any ideas?</p>