title: Unable to send email using core php
body: <p>I'am newbie in php. I'am trying to send email using php but I don't know what's wrong in my code. I googled a lot but nothing has worked yet. Here is my php code. I'am using class.phpmailer.php.</p>
  
  <pre><code>&lt;?php
  
  require("phpmailer-master/class.phpmailer.php");
  $mail = new PHPMailer();
  $mail-&gt;IsSMTP(); // send via SMTP
  IsSMTP(); // send via SMTP
  $mail-&gt;SMTPAuth = true; // turn on SMTP authentication
  $mail-&gt;Username = "myemail@googlemail.com"; // SMTP username
  $mail-&gt;Password = "mypassword"; // SMTP password
  $webmaster_email = "recipient@googlemail.com"; //Reply to this email ID
  $email="username@domain.com"; // Recipients email ID
  $name="myname"; // Recipient's name
  $mail-&gt;From = $webmaster_email;
  $mail-&gt;FromName = "Webmaster";
  $mail-&gt;AddAddress($email,$name);
  $mail-&gt;AddReplyTo($webmaster_email,"Webmaster");
  $mail-&gt;WordWrap = 50; // set word wrap
  $mail-&gt;AddAttachment("/var/tmp/file.tar.gz"); // attachment
  $mail-&gt;AddAttachment("/tmp/image.jpg", "new.jpg"); // attachment
  $mail-&gt;IsHTML(true); // send as HTML
  $mail-&gt;Subject = "This is the subject";
  $mail-&gt;Body = "Hi,
  This is the HTML BODY "; //HTML Body
  $mail-&gt;AltBody = "This is the body when user views in plain text format"; //Text Body
  if(!$mail-&gt;Send())
  {
  echo "Mailer Error: " . $mail-&gt;ErrorInfo;
  }
  else
  {
  echo "Message has been sent";
  }
  ?&gt;
  echo "Mailer Error: " . $mail-&gt;ErrorInfo;
  }
  else
  {
  echo "Message has been sent";
  }
  ?&gt;
  </code></pre>