title: Email through PHPMailer is slow
body: <p>When I am sending via Gmail using phpmailer, the email is taking a long time to send and also sometimes it is not going. I am using XAMPP as localhost.</p>
  
  <p>Here is my Code:</p>
  
  <pre><code>if($_POST['submit']{
  /*MAIL PART BEGINS*/
  
          //error_reporting(E_ALL);
          error_reporting(E_STRICT);
  
          date_default_timezone_set('America/Toronto');
  
          require_once('class.phpmailer.php');
          //include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
  
          $mail             = new PHPMailer();
  
          $body             = "Your Password has been generated.&lt;p /&gt;";
          $body             .="New Password = '$password'&lt;p /&gt;";
          $body             .="Please Login with your Employee ID and this password and you can change the password at any time.";
          //$body           .="Amount Requested = '$amount'&lt;p /&gt;";
          //$body           .="Amount Sanctioned = '$amount_sanctioned'&lt;p /&gt;";
          $body             = eregi_replace("[\]",'',$body);
  
          $mail-&gt;IsSMTP(); // telling the class to use SMTP
          $mail-&gt;Host       = "stmp.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   = "my_username@gmail.com";  // GMAIL username
          $mail-&gt;Password   = "******";            // GMAIL password
  
          $mail-&gt;SetFrom('my_username@gmail.com', 'First Last');
  
          $mail-&gt;AddReplyTo("my_username@gmail.com","First Last");
  
          $mail-&gt;Subject    = "Change Password";
  
          //$mail-&gt;AltBody    = "Hello...!!!"; // optional, comment out and test
  
          $mail-&gt;MsgHTML($body);
  
          $address = "$email"; 
          //$address1 = "my_username@gmail@hotmail.com";
          //$address2 = "my_username@gmail@rediffmail.com";
          //$address3 = "my_username@gmail@iicb.res.in";
          $mail-&gt;AddAddress($address, "First Last");
          //$mail-&gt;AddAddress($address1, "First Last");
          //$mail-&gt;AddAddress($address2, "First Last");
          //$mail-&gt;AddAddress($address3, "First Last");
  
  
  
          //$mail-&gt;AddAttachment("images/phpmailer.gif");      // attachment
          //$mail-&gt;AddAttachment("images/phpmailer_mini.gif"); // attachment
  
          if(!$mail-&gt;Send()) {
              echo "Mailer Error: " . $mail-&gt;ErrorInfo;
          } else {
              echo "Message sent!";
          }
          //MAIL PART ENDS*/
  }
  </code></pre>