title: Getting "Cannot access empty property" when using PHP Mailer
body: <p>I'm getting this error message trying to use PHP Mailer.  Please let me know if you see what is wrong. </p>
  
  <pre><code>Fatal error: Cannot access empty property in /hsphere/local/home/c263430/quoralist.com/includes/phpmailer/phpmailer.inc.php on line 271
  </code></pre>
  
  <p>Line 271 of phpmailer.inc.php is</p>
  
  <pre><code>$header[] = sprintf("Content-Transfer-Encoding: %s\n", $this-&gt;$Encoding);
  </code></pre>
  
  <p>The code that called phpmailer.inc.php is </p>
  
  <pre><code>&lt;?php
  
  require_once("../includes/phpmailer/phpmailer.inc.php");
  require_once("../includes/phpmailer/smtp.inc.php");
  $to_name = "Junk Mail";
  $to = "m73mit@gmail.com";
  $subject = "Mail Test at ".strftime("%T", time());
  $message = "This is a test.";
  $message = wordwrap($message, 70);
  $from_name = "Michael Mitchell";
  $from = "michaeljohnmitchell@gmail.com";
  
  //Php mail version (default)
  $mail = new PHPMailer();
  
  //$mail-&gt;IsSMTP();
  //$mail-&gt;Host   = "host"
  //$mail-&gt;Port       = 25;
  //$mail-&gt;SMTPAuth   = false;
  //$mail-&gt;Username   = "username";
  //$mail-&gt;Password   = "password";
  
  
  $mail-&gt;FromName = $from_name;
  $mail-&gt;From     = $from;
  $mail-&gt;AddAddress($to, $to_name);
  $mail-&gt;Subject  = $subject;
  $mail-&gt;Body     = $message;
  
  $result = $mail-&gt;Send();
  
  echo $result ? 'Sent' : 'Error';
  
  
  ?&gt;
  </code></pre>
  
  <p>EDIT</p>
  
  <p>following a suggestion in one of the answers, I tried <code>$this-&gt;Encoding</code> instead of <code>$this-&gt;$Encoding</code>.  When I ran it I got a new error message, not sure if it's related. </p>
  
  <pre><code>Fatal error: Cannot redeclare class SMTP in /hsphere/local/home/c263430/quoralist.com/includes/phpmailer/smtp.inc.php on line 26
  </code></pre>
  
  <p>The class at line 26 of smtp.inc.php is </p>
  
  <pre><code>class SMTP {
          var $SMTP_PORT = 25; # the default SMTP PORT
          var $CRLF = "\r\n";  # CRLF pair
  
          var $smtp_conn;      # the socket to the server
          var $error;          # error if any on the last call
          var $helo_rply;      # the reply the server sent to us for HELO
  
          var $do_debug;       # the level of debug to perform
  </code></pre>