]> git.mxchange.org Git - mailer.git/blobdiff - inc/phpmailer/class.phpmailer.php
redirection of invalid or deleted mail orders improved, several code conventions...
[mailer.git] / inc / phpmailer / class.phpmailer.php
index 3ca9f7cc1d9d6327a584abe6ed27a2c7c8fc7b01..0879aff5e298b6bcfba2c23fe4d0c93d8505077e 100644 (file)
@@ -66,7 +66,7 @@ class PHPMailer {
    * Holds the most recent mailer error message.
    * @var string
    */
-  var $ErrorInfo         = '';
+  var $ErrorInfo         = "";
 
   /**
    * Sets the From email address for the message.
@@ -85,20 +85,20 @@ class PHPMailer {
    * will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.
    * @var string
    */
-  var $Sender            = '';
+  var $Sender            = "";
 
   /**
    * Sets the Subject of the message.
    * @var string
    */
-  var $Subject           = '';
+  var $Subject           = "";
 
   /**
    * Sets the Body of the message.  This can be either an HTML or text body.
    * If HTML then run IsHTML(true).
    * @var string
    */
-  var $Body              = '';
+  var $Body              = "";
 
   /**
    * Sets the text-only body of the message.  This automatically sets the
@@ -107,7 +107,7 @@ class PHPMailer {
    * that can read HTML will view the normal Body.
    * @var string
    */
-  var $AltBody           = '';
+  var $AltBody           = "";
 
   /**
    * Sets word wrapping on the body of the message to a given number of
@@ -133,7 +133,7 @@ class PHPMailer {
    * is in a different directory than the PHP include path.
    * @var string
    */
-  var $PluginDir         = '';
+  var $PluginDir         = "";
 
   /**
    * Holds PHPMailer version.
@@ -145,7 +145,7 @@ class PHPMailer {
    * Sets the email address that a reading confirmation will be sent.
    * @var string
    */
-  var $ConfirmReadingTo  = '';
+  var $ConfirmReadingTo  = "";
 
   /**
    * Sets the hostname to use in Message-Id and Received headers
@@ -153,7 +153,7 @@ class PHPMailer {
    * by SERVER_NAME is used or 'localhost.localdomain'.
    * @var string
    */
-  var $Hostname          = '';
+  var $Hostname          = "";
 
   /////////////////////////////////////////////////
   // PROPERTIES FOR SMTP
@@ -179,7 +179,7 @@ class PHPMailer {
    * Sets the SMTP HELO of the message (Default is $Hostname).
    * @var string
    */
-  var $Helo        = '';
+  var $Helo        = "";
 
   /**
    * Sets connection prefix.
@@ -198,13 +198,13 @@ class PHPMailer {
    * Sets SMTP username.
    * @var string
    */
-  var $Username     = '';
+  var $Username     = "";
 
   /**
    * Sets SMTP password.
    * @var string
    */
-  var $Password     = '';
+  var $Password     = "";
 
   /**
    * Sets the SMTP server timeout in seconds. This function will not
@@ -245,7 +245,7 @@ class PHPMailer {
   var $ReplyTo         = array();
   var $attachment      = array();
   var $CustomHeader    = array();
-  var $message_type    = '';
+  var $message_type    = "";
   var $boundary        = array();
   var $language        = array();
   var $error_count     = 0;
@@ -311,7 +311,7 @@ class PHPMailer {
    * @param string $name
    * @return void
    */
-  function AddAddress($address, $name = '') {
+  function AddAddress($address, $name = "") {
     $cur = count($this->to);
     $this->to[$cur][0] = trim($address);
     $this->to[$cur][1] = $name;
@@ -325,7 +325,7 @@ class PHPMailer {
    * @param string $name
    * @return void
    */
-  function AddCC($address, $name = '') {
+  function AddCC($address, $name = "") {
     $cur = count($this->cc);
     $this->cc[$cur][0] = trim($address);
     $this->cc[$cur][1] = $name;
@@ -339,7 +339,7 @@ class PHPMailer {
    * @param string $name
    * @return void
    */
-  function AddBCC($address, $name = '') {
+  function AddBCC($address, $name = "") {
     $cur = count($this->bcc);
     $this->bcc[$cur][0] = trim($address);
     $this->bcc[$cur][1] = $name;
@@ -351,7 +351,7 @@ class PHPMailer {
    * @param string $name
    * @return void
    */
-  function AddReplyTo($address, $name = '') {
+  function AddReplyTo($address, $name = "") {
     $cur = count($this->ReplyTo);
     $this->ReplyTo[$cur][0] = trim($address);
     $this->ReplyTo[$cur][1] = $name;
@@ -368,8 +368,8 @@ class PHPMailer {
    * @return bool
    */
   function Send() {
-    $header = '';
-    $body = '';
+    $header = "";
+    $body = "";
     $result = true;
 
     if((count($this->to) + count($this->cc) + count($this->bcc)) < 1) {
@@ -387,7 +387,7 @@ class PHPMailer {
     $header .= $this->CreateHeader();
     $body = $this->CreateBody();
 
-    if($body == '') {
+    if($body == "") {
       return false;
     }
 
@@ -449,7 +449,7 @@ class PHPMailer {
    */
   function MailSend($header, $body) {
 
-    $to = '';
+    $to = "";
     for($i = 0; $i < count($this->to); $i++) {
       if($i != 0) { $to .= ', '; }
       $to .= $this->AddrFormat($this->to[$i]);
@@ -499,14 +499,14 @@ class PHPMailer {
    */
   function SmtpSend($header, $body) {
     include_once($this->PluginDir . 'class.smtp.php');
-    $error = '';
+    $error = "";
     $bad_rcpt = array();
 
     if(!$this->SmtpConnect()) {
       return false;
     }
 
-    $smtp_from = ($this->Sender == '') ? $this->From : $this->Sender;
+    $smtp_from = ($this->Sender == "") ? $this->From : $this->Sender;
     if(!$this->smtp->Mail($smtp_from)) {
       $error = $this->Lang('from_failed') . $smtp_from;
       $this->SetError($error);
@@ -585,7 +585,7 @@ class PHPMailer {
         $port = $this->Port;
       }
 
-      if($this->smtp->Connect(((!empty($this->SMTPSecure))?$this->SMTPSecure.'://':'').$host, $port, $this->Timeout)) {
+      if($this->smtp->Connect(((!empty($this->SMTPSecure))?$this->SMTPSecure.'://':"").$host, $port, $this->Timeout)) {
         if ($this->Helo != '') {
           $this->smtp->Hello($this->Helo);
         } else {
@@ -699,10 +699,10 @@ class PHPMailer {
     }
 
     $line = explode($this->LE, $message);
-    $message = '';
+    $message = "";
     for ($i=0 ;$i < count($line); $i++) {
       $line_part = explode(' ', $line[$i]);
-      $buf = '';
+      $buf = "";
       for ($e = 0; $e<count($line_part); $e++) {
         $word = $line_part[$e];
         if ($qp_mode and (strlen($word) > $length)) {
@@ -722,7 +722,7 @@ class PHPMailer {
             } else {
               $message .= $buf . $soft_break;
             }
-            $buf = '';
+            $buf = "";
           }
           while (strlen($word) > 0) {
             $len = $length;
@@ -784,7 +784,7 @@ class PHPMailer {
    * @return string
    */
   function CreateHeader() {
-    $result = '';
+    $result = "";
 
     /* Set the boundaries */
     $uniq_id = md5(uniqid(time()));
@@ -792,7 +792,7 @@ class PHPMailer {
     $this->boundary[2] = 'b2_' . $uniq_id;
 
     $result .= $this->HeaderLine('Date', $this->RFCDate());
-    if($this->Sender == '') {
+    if($this->Sender == "") {
       $result .= $this->HeaderLine('Return-Path', trim($this->From));
     } else {
       $result .= $this->HeaderLine('Return-Path', trim($this->Sender));
@@ -882,16 +882,16 @@ class PHPMailer {
    * @return string
    */
   function CreateBody() {
-    $result = '';
+    $result = "";
 
     $this->SetWordWrap();
 
     switch($this->message_type) {
       case 'alt':
-        $result .= $this->GetBoundary($this->boundary[1], '', 'text/plain', '');
+        $result .= $this->GetBoundary($this->boundary[1], "", 'text/plain', "");
         $result .= $this->EncodeString($this->AltBody, $this->Encoding);
         $result .= $this->LE.$this->LE;
-        $result .= $this->GetBoundary($this->boundary[1], '', 'text/html', '');
+        $result .= $this->GetBoundary($this->boundary[1], "", 'text/html', "");
         $result .= $this->EncodeString($this->Body, $this->Encoding);
         $result .= $this->LE.$this->LE;
         $result .= $this->EndBoundary($this->boundary[1]);
@@ -900,7 +900,7 @@ class PHPMailer {
         $result .= $this->EncodeString($this->Body, $this->Encoding);
         break;
       case 'attachments':
-        $result .= $this->GetBoundary($this->boundary[1], '', '', '');
+        $result .= $this->GetBoundary($this->boundary[1], "", "", "");
         $result .= $this->EncodeString($this->Body, $this->Encoding);
         $result .= $this->LE;
         $result .= $this->AttachAll();
@@ -908,10 +908,10 @@ class PHPMailer {
       case 'alt_attachments':
         $result .= sprintf("--%s%s", $this->boundary[1], $this->LE);
         $result .= sprintf("Content-Type: %s;%s" . "\tboundary=\"%s\"%s", 'multipart/alternative', $this->LE, $this->boundary[2], $this->LE.$this->LE);
-        $result .= $this->GetBoundary($this->boundary[2], '', 'text/plain', '') . $this->LE; // Create text body
+        $result .= $this->GetBoundary($this->boundary[2], "", 'text/plain', "") . $this->LE; // Create text body
         $result .= $this->EncodeString($this->AltBody, $this->Encoding);
         $result .= $this->LE.$this->LE;
-        $result .= $this->GetBoundary($this->boundary[2], '', 'text/html', '') . $this->LE; // Create the HTML body
+        $result .= $this->GetBoundary($this->boundary[2], "", 'text/html', "") . $this->LE; // Create the HTML body
         $result .= $this->EncodeString($this->Body, $this->Encoding);
         $result .= $this->LE.$this->LE;
         $result .= $this->EndBoundary($this->boundary[2]);
@@ -919,7 +919,7 @@ class PHPMailer {
         break;
     }
     if($this->IsError()) {
-      $result = '';
+      $result = "";
     }
 
     return $result;
@@ -930,14 +930,14 @@ class PHPMailer {
    * @access private
    */
   function GetBoundary($boundary, $charSet, $contentType, $encoding) {
-    $result = '';
-    if($charSet == '') {
+    $result = "";
+    if($charSet == "") {
       $charSet = $this->CharSet;
     }
-    if($contentType == '') {
+    if($contentType == "") {
       $contentType = $this->ContentType;
     }
-    if($encoding == '') {
+    if($encoding == "") {
       $encoding = $this->Encoding;
     }
     $result .= $this->TextLine('--' . $boundary);
@@ -1009,14 +1009,14 @@ class PHPMailer {
    * @param string $type File extension (MIME) type.
    * @return bool
    */
-  function AddAttachment($path, $name = '', $encoding = 'base64', $type = 'application/octet-stream') {
+  function AddAttachment($path, $name = "", $encoding = 'base64', $type = 'application/octet-stream') {
     if(!@is_file($path)) {
       $this->SetError($this->Lang('file_access') . $path);
       return false;
     }
 
     $filename = basename($path);
-    if($name == '') {
+    if($name == "") {
       $name = $filename;
     }
 
@@ -1074,13 +1074,13 @@ class PHPMailer {
       if($bString) {
         $mime[] = $this->EncodeString($string, $encoding);
         if($this->IsError()) {
-          return '';
+          return "";
         }
         $mime[] = $this->LE.$this->LE;
       } else {
         $mime[] = $this->EncodeFile($path, $encoding);
         if($this->IsError()) {
-          return '';
+          return "";
         }
         $mime[] = $this->LE.$this->LE;
       }
@@ -1088,7 +1088,7 @@ class PHPMailer {
 
     $mime[] = sprintf("--%s--%s", $this->boundary[1], $this->LE);
 
-    return join('', $mime);
+    return join("", $mime);
   }
 
   /**
@@ -1100,7 +1100,7 @@ class PHPMailer {
   function EncodeFile ($path, $encoding = 'base64') {
     if(!@$fd = fopen($path, 'rb')) {
       $this->SetError($this->Lang('file_open') . $path);
-      return '';
+      return "";
     }
     $magic_quotes = get_magic_quotes_runtime();
     set_magic_quotes_runtime(0);
@@ -1119,7 +1119,7 @@ class PHPMailer {
    * @return string
    */
   function EncodeString ($str, $encoding = 'base64') {
-    $encoded = '';
+    $encoded = "";
     switch(strtolower($encoding)) {
       case 'base64':
         /* chunk_split is found in PHP >= 3.0.6 */
@@ -1203,15 +1203,15 @@ class PHPMailer {
    * @access private
    * @return string
    */
-  function EncodeQP( $input = '', $line_max = 76, $space_conv = false ) {
+  function EncodeQP( $input = "", $line_max = 76, $space_conv = false ) {
     $hex = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
     $lines = preg_split('/(?:\r\n|\r|\n)/', $input);
     $eol = "\r\n";
     $escape = '=';
-    $output = '';
+    $output = "";
     while( list(, $line) = each($lines) ) {
       $linlen = strlen($line);
-      $newline = '';
+      $newline = "";
       for($i = 0; $i < $linlen; $i++) {
         $c = substr( $line, $i, 1 );
         $dec = ord( $c );
@@ -1231,7 +1231,7 @@ class PHPMailer {
         }
         if ( (strlen($newline) + strlen($c)) >= $line_max ) { // CRLF is not counted
           $output .= $newline.$escape.$eol; //  soft line break; " =\r\n" is okay
-          $newline = '';
+          $newline = "";
           // check if newline first character will be point or not
           if ( $dec == 46 ) {
             $c = '=2E';
@@ -1251,7 +1251,7 @@ class PHPMailer {
    */
   function EncodeQ ($str, $position = 'text') {
     /* There should not be any EOL in the string */
-    $encoded = preg_replace("[\r\n]", '', $str);
+    $encoded = preg_replace("[\r\n]", "", $str);
 
     switch (strtolower($position)) {
       case 'phrase':
@@ -1309,7 +1309,7 @@ class PHPMailer {
    * @param string $type File extension (MIME) type.
    * @return bool
    */
-  function AddEmbeddedImage($path, $cid, $name = '', $encoding = 'base64', $type = 'application/octet-stream') {
+  function AddEmbeddedImage($path, $cid, $name = "", $encoding = 'base64', $type = 'application/octet-stream') {
 
     if(!@is_file($path)) {
       $this->SetError($this->Lang('file_access') . $path);
@@ -1317,7 +1317,7 @@ class PHPMailer {
     }
 
     $filename = basename($path);
-    if($name == '') {
+    if($name == "") {
       $name = $filename;
     }
 
@@ -1467,7 +1467,7 @@ class PHPMailer {
     if(isset($_SERVER[$varName])) {
       return $_SERVER[$varName];
     } else {
-      return '';
+      return "";
     }
   }
 
@@ -1568,7 +1568,7 @@ class PHPMailer {
    * @access private
    * @return mime type of ext
    */
-  function _mime_types($ext = '') {
+  function _mime_types($ext = "") {
     $mimes = array(
       'hqx'  =>  'application/mac-binhex40',
       'cpt'   =>  'application/mac-compactpro',
@@ -1672,7 +1672,7 @@ class PHPMailer {
    * @param mixed $value Parameter Value
    * NOTE: will not work with arrays, there are no arrays to set/reset
    */
-  function set ( $name, $value = '' ) {
+  function set ( $name, $value = "" ) {
     if ( isset($this->$name) ) {
       $this->$name = $value;
     } else {
@@ -1688,7 +1688,7 @@ class PHPMailer {
    * @param string $filename Parameter File Name
    */
   function getFile($filename) {
-    $return = '';
+    $return = "";
     if ($fp = fopen($filename, 'rb')) {
       while (!feof($fp)) {
         $return .= fread($fp, 1024);