title: php mail() - delivered as spam(using php mailer library)
body: <pre><code>require("class.phpmailer.php");
  
  $mail = new PHPMailer()
  
  $mail-&gt;From = "sender@gmail.com";
  $mail-&gt;AddAddress("recipient@gmail.com");                 // name is optional
  $mail-&gt;AddReplyTo("sender@gmail.com");
  
  $mail-&gt;WordWrap = 50;                                    // set word wrap to 50 characters
  $mail-&gt;IsHTML(true);                                  // set email format to HTML
  
  $mail-&gt;Subject = "Here is the subject";
  $mail-&gt;Body    = "This is the HTML message body &lt;b&gt;in bold!&lt;/b&gt;";
  $mail-&gt;AltBody = "This is the body in plain text for non-HTML mail clients";
  
  if(!$mail-&gt;Send())
  {
     echo "Message could not be sent. &lt;p&gt;";
     echo "Mailer Error: " . $mail-&gt;ErrorInfo;
     exit;
  }
  
  echo "Message has been sent";
  </code></pre>
  
  <p>I don't know what headers i need to add, to send the email NOT as spam, and how can i use this?</p>
  
  <pre><code>//$mail-&gt;IsSMTP(); // is this necessary?
  //$mail-&gt;Host = "some host ip";  // what i need to write here?
  //$mail-&gt;SMTPAuth = true;     // is this necessary to send email NOT as spam?
  //$mail-&gt;Username = "test";  // and this?
  //$mail-&gt;Password = "secret"; // and this?
  </code></pre>
  
  <p>for some time googling , I didn't find any clear information about how to send an email NOT as spam... any ideas?</p>