title: PHPMailer Gives Error Message: "PHP Parse error: parse error, unexpected '{' in mailer.php on line 23"
body: <p>I made a website for a club of my university and I used PHPMailer. When I try it in my own server, it works perfectly. However after I upload the site to the school's FTP, my PHPMailer is not working. I contacted the school IT and they said: "The version of PHP on the server is 4.3.9. Codes that you wrote must be suitable for it. In server's error logs we got the following error: PHP Parse error:  parse error, unexpected '{' in mailer.php on line 23".
  I checked my codes billion times but I cannot solve the problem on that. Here is my code:</p>
  
  <pre><code>&lt;?
  if(!empty($_POST['sender_mail'])
      || !empty($_POST['sender_name'])
      || !empty($_POST['sender_surname'])
      || !empty($_POST['sender_major'])
      || !empty($_POST['sender_schoolyear'])
      || !empty($_POST['sender_id']))
  {
    phpinfo();
      require_once('class.phpmailer.php');
      include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
      $smail = $_POST['sender_mail'];
      $name = $_POST['sender_name'];
      $surname = $_POST['sender_surname'];
      $major = $_POST['sender_major'];
      $schoolyear = $_POST['sender_schoolyear'];
      $id = $_POST['sender_id'];
  
      $mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch
  
      $mail-&gt;IsSMTP(); // telli ng the class to use SMTP
  
      try { // Here is 23th line
        $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   = "xxxxx@gmail.com";  // GMAIL username
        $mail-&gt;Password   = "xxxxxxx";            // GMAIL password
        $mail-&gt;AddAddress('xxxxx@gmail.com', 'Membership');
        $mail-&gt;SetFrom('xxxxx@gmail.com', 'GGK');
        $mail-&gt;Subject = 'New Membership';
        $mail-&gt;IsHTML(true);
        $mail-&gt;Body = '&lt;h3&gt;New Membership&lt;/h3&gt;&lt;br/&gt;&lt;i&gt;&lt;b&gt;Name: &lt;/i&gt;&lt;/b&gt;&lt;i&gt;' . $name . '&lt;/i&gt;&lt;br/&gt;&lt;b&gt;&lt;i&gt;Surname: &lt;/i&gt;&lt;/b&gt;&lt;i&gt;' . $surname . '&lt;/i&gt;&lt;br/&gt;&lt;b&gt;&lt;i&gt;Mail: &lt;/i&gt;&lt;/b&gt;&lt;i&gt;' . $smail . '&lt;/i&gt;&lt;br/&gt;&lt;b&gt;&lt;i&gt;ID: &lt;/i&gt;&lt;/b&gt;&lt;i&gt;' . $id .  '&lt;/i&gt;&lt;br/&gt;&lt;b&gt;&lt;i&gt;Schoolyear: &lt;/b&gt;&lt;/i&gt;&lt;i&gt;' . $schoolyear . '&lt;/i&gt;&lt;br/&gt;&lt;b&gt;&lt;i&gt;Major: &lt;/b&gt;&lt;/i&gt;&lt;i&gt;' . $major . '&lt;/i&gt;';
        $mail-&gt;Send();
        echo "Message Sent OK&lt;/p&gt;\n";
      } catch (phpmailerException $e) {
          echo -1;
        echo $e-&gt;errorMessage(); //Pretty error messages from PHPMailer
      } catch (Exception $e) {
        echo -1;  
        echo $e-&gt;getMessage(); //Boring error messages from anything else!
      }
  }
  else{
      echo -1;
  }
  ?&gt;
  </code></pre>
  
  <p>Note: I got all values of the form with ajax and post them to mailer.php.</p>