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.

Here is my Code:




            //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.<p />";
            $body             .="New Password = '$password'<p />";
            $body             .="Please Login with your Employee ID and this password and you can change the password at any time.";
            //$body           .="Amount Requested = '$amount'<p />";
            //$body           .="Amount Sanctioned = '$amount_sanctioned'<p />";
            $body             = eregi_replace("[\]",'',$body);

            $mail->IsSMTP(); // telling the class to use SMTP
            $mail->Host       = "stmp.gmail.com"; // SMTP server
            $mail->SMTPDebug  = 1;                     // enables SMTP debug information (for testing)
                                           // 1 = errors and messages
                                           // 2 = messages only
            $mail->SMTPAuth   = true;                  // enable SMTP authentication
            $mail->SMTPSecure = "ssl";                 // sets the prefix to the servier
            $mail->Host       = "smtp.gmail.com";      // sets GMAIL as the SMTP server
            $mail->Port       = 465;                   // set the SMTP port for the GMAIL server
            $mail->Username   = "my_username@gmail.com";  // GMAIL username
            $mail->Password   = "******";            // GMAIL password

            $mail->SetFrom('my_username@gmail.com', 'First Last');

            $mail->AddReplyTo("my_username@gmail.com","First Last");

            $mail->Subject    = "Change Password";

            //$mail->AltBody    = "Hello...!!!"; // optional, comment out and test


            $address = "$email"; 
            //$address1 = "my_username@gmail@hotmail.com";
            //$address2 = "my_username@gmail@rediffmail.com";
            //$address3 = "my_username@gmail@iicb.res.in";
            $mail->AddAddress($address, "First Last");
            //$mail->AddAddress($address1, "First Last");
            //$mail->AddAddress($address2, "First Last");
            //$mail->AddAddress($address3, "First Last");

            //$mail->AddAttachment("images/phpmailer.gif");      // attachment
            //$mail->AddAttachment("images/phpmailer_mini.gif"); // attachment

            if(!$mail->Send()) {
                echo "Mailer Error: " . $mail->ErrorInfo;
            } else {
                echo "Message sent!";
            //MAIL PART ENDS*/

Have you set the mercury as mail service?

Have you set the mercury as mail service?

NO, I didn't do it. How is that done?

Have you set the mercury as mail service?

He's not sending through localhost, but directly to GMail. Are you sure that Mercury is necessary ?

Is there perhaps anything else that could slow it down, like your firewall on your PC or router ?

My windows firewall is turned off and im using no antivirus. What could probably slow down my emails?

Can't think of a reason. Can't remember having problems with it, unless you are sending thousands of e-mails.