title: PHPMailer works on localhost but on but not on server
body: <p>I'm trying to send a mail that is contents.html to some person, this code works fine on XAMPP but doesn't work on server, just shows empty screen and ends up without sending mail, What am I doing wrong?</p>
  
  <p><strong>gmail.php</strong></p>
  
  <pre><code> &lt;?php
      include('/mailer/class.phpmailer.php');
      include('/mailer/class.smtp.php'); // optional, gets called from within class.phpmailer.php if not already loaded
      $hodemail = strtolower($branch)."hodofsrit@gmail.com";
      echo '1';
      $mail = new PHPMailer(); // create a new object
      $mail-&gt;IsSMTP(); // enable SMTP
      echo '2';
      $mail-&gt;SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only
      $mail-&gt;SMTPAuth = true; // authentication enabled
      $mail-&gt;SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for GMail
      $mail-&gt;Host = "ssl://smtp.gmail.com";
      $mail-&gt;Port = 465; // or 587
      $mail-&gt;IsHTML(true);
      $mail-&gt;Username = "xxxxxxxxxx";
      $mail-&gt;Password = "xxxxxxxx";
      $mail-&gt;SetFrom("134g1a05a1@srit.ac.in");
      $mail-&gt;Subject = "Student Feedback ".$branch . " ".$yearandsem;
      $mail-&gt;Body = "hello, Here's the graph generated";
      $mail-&gt;msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
      $mail-&gt;AddAddress($hodemail);
       if(!$mail-&gt;Send())
          {
              $error = $mail-&gt;ErrorInfo;
          header('Location:sendmail.php?errormsg=There was an error in sending email '.$error);
          }
          else
          {
          function redirect($url)
          {
          $string = '&lt;script type="text/javascript"&gt;';
          $string .= 'window.location = "' . $url . '"';
          $string .= '&lt;/script&gt;';
          echo $string;
          }
         redirect('sendmail.php?msg=Email Successfully sent to corresponding HOD!');
          }
      ?&gt;  
  </code></pre>
  
  <p><strong>send_mail.pgp</strong></p>
  
  <pre><code>&lt;?php 
  session_start();
   if(isset($_SESSION['admin'])){
      $branch = $_POST['branch'];
  $yearandsem = $_POST['yearandsem'];
   include 'displaygraphs.php';
   include'gmail.php';
   } 
  else {
      header('location:index.php?msg="Login First"');
  }
  ?&gt;
  </code></pre>
  
  <p>the displaygraphs is working fine, after I tested with some <code>echo's</code>, I came to know that the page is stopping after the line <code>$mail = new PHPMailer();</code> line in gmail.php, please help me solve this, Thank You!</p>