title: sending mail with PHPmailer using gmail smtp is flagged as spam
body: <p>When i try to send a  mail with PHPmailer via gmail smtp server the mail will be flagged as spam. i am using a hotmail account to receive the email.</p>
  
  <p>i've looked to other topics about this problem but they mention that they set the "from" to their own domain name but for me myaccount@gmail.com is good enough.</p>
  
  <p>this is the code i use:</p>
  
  <pre><code>$mail             = new PHPMailer();
  $body             = "test";
  $mail-&gt;IsSMTP();
  $mail-&gt;SMTPDebug  = 1;
  $mail-&gt;SMTPAuth   = true;
  $mail-&gt;SMTPSecure = "ssl";  
  $mail-&gt;Host       = "smtp.gmail.com";
  $mail-&gt;Port       = 465;                  
  $mail-&gt;Username   = "myaccount@gmail.com"; 
  $mail-&gt;Password   = "mypassword";            
  $mail-&gt;SetFrom('myaccount@gmail.com', 'myaccount');
  $mail-&gt;Subject    = "Test subject";
  $mail-&gt;MsgHTML($body);
  $address = "myaccount@hotmail.com";
  $mail-&gt;AddAddress($address, "test"); 
  $mail-&gt;Send()
  </code></pre>
  
  <p>I've read this topic: 
  <a href="https://stackoverflow.com/questions/371/how-do-you-make-sure-email-you-send-programmatically-is-not-automatically-marked">How do you make sure email you send programmatically is not automatically marked as spam?</a> </p>
  
  <p>but like i said i don't need my own domain name. Or is this impossible and do i need to use my own domain and use SPF and DKIM?</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>I've tested sending emails to yahoo and gmail and both work only hotmail will mark them as spam.</p>
  
  <p><strong>Solved:</strong></p>
  
  <p>I tried to send a mail with the gmail webclient and even then my mail gets flagged as spam. Somehow the gmail smtp servers are blacklisted. So i created an hotmail account and changed the code to use hotmail smpt server.</p>
  
  <pre><code>$mail-&gt;SMTPSecure = "tls";              
  $mail-&gt;Host       = 'smtp.live.com';  
  $mail-&gt;Port       = 587; 
  </code></pre>
  
  <p>Now my mails are not marked as spam anymore on yahoo gmail and hotmail.</p>