title: PHP Send email using google apps smtp
body: <p>I have one domain with some emails and use with this domain google apps , in this case i want use the smtp of gmail for send without problems somes emails to my customers </p>
  
  <p><strong>Tha case the script no working for me , i put the case</strong> </p>
  
  <pre><code>date_default_timezone_set('Europe/Paris');
  
  require_once("class.phpmailer.php");
  require_once("class.smtp.php");
  
  
  $mail             = new PHPMailer();
  $body             = "gdssdh";
  //$body             = eregi_replace("[\]",'',$body);
  
  $mail-&gt;IsSMTP(); // telling the class to use SMTP
  $mail-&gt;Host       = "ssl://smtp.gmail.com"; // SMTP server
  $mail-&gt;SMTPDebug  = 1;                     // enables SMTP debug information (for testing)
                                             // 1 = errors and messages
                                             // 2 = messages only
  $mail-&gt;SMTPAuth   = true;                  // enable SMTP authentication
  $mail-&gt;SMTPSecure = "ssl";                 // sets the prefix to the servier
  $mail-&gt;Host       = "smtp.gmail.com";      // sets GMAIL as the SMTP server
  $mail-&gt;Port       = 465;                   // set the SMTP port for the GMAIL server
  $mail-&gt;Username   = "user@gmail.com";  // GMAIL username
  $mail-&gt;Password   = "123456789";            // GMAIL password
  
  $mail-&gt;SetFrom('accountemail@mydomain.com', 'PRSPS');
  
  //$mail-&gt;AddReplyTo("user2@gmail.com', 'First Last");
  
  $mail-&gt;Subject    = "Hello it´s a test";
  
  //$mail-&gt;AltBody    = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
  
  $mail-&gt;MsgHTML($body);
  </code></pre>