Getting Error 405 (Not Allowed) on PHPMailer
<p>I'm trying to use PHPMailer to send emails from a contact form. Once submitted, the server doesn't respond for more than 5 minutes, then results in <code>ERROR 405 Not Allowed - ngnix</code>.</p>

<p>I'm using SMTP Auth from webmaster@mydomain.com, and the SMTP server is located at voyager.websitewelcome.com. I thought, "Could it be because of the cross-domain submission, even though this isn't AJAX and is all PHP?"</p>

<p>Nope, see answer below:</p>

<pre><code>mail = new PHPMailer;

$mail-&gt;isSMTP();
$mail-&gt;Host = 'voyager.websitewelcome.com';
$mail-&gt;SMTPAuth = true;
$mail-&gt;Username = 'webmaster@mydomain.com';
$mail-&gt;Password = 'mypassword';
$mail-&gt;SMTPSecure = 'tls'; //&lt;---- THIS is the problem
$mail-&gt;Port = 465;

$mail-&gt;setFrom('webmaster@mydomain', 'My Company Kiosk');
$mail-&gt;addAddress('me@mydomain.com', 'My Name');

$mail-&gt;isHTML(true);

$mail-&gt;Subject = 'New Lead from My Company';
$mail-&gt;Body    = '&lt;b&gt;test&lt;/b&gt; html'; //$body;
$mail-&gt;AltBody = 'test text';


try {
  $mail-&gt;send();
  //echo $output;
}
catch (phpmailerException $e) {
  echo $e-&gt;errorMessage();
} catch (Exception $e) {
  $e-&gt;getMessage();
}
</code></pre>