 <p>There are double quotes in</p> <pre><code>$mail-&gt;Host = "smtp.gmail.com"; // SMTP server </code></pre> <p>Please remove the double quotes.</p> <pre><code>$mail-&gt;Host = 'smtp.gmail.com'; // SMTP server </code></pre>