tbrehm
2012-01-25 175eab39839bb0a72f0fb7378539a708d1e4253a
server/plugins-available/mail_plugin.inc.php
@@ -160,24 +160,30 @@
      
      //* Send the welcome email message
      if(file_exists($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$conf['language'].'.txt')) {
         $tmp = file($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$conf['language'].'.txt');
         $lines = file($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$conf['language'].'.txt');
      } elseif(file_exists($conf['rootpath'].'/conf-custom/mail/welcome_email_en.txt')) {
         $tmp = file($conf['rootpath'].'/conf-custom/mail/welcome_email_en.txt');
         $lines = file($conf['rootpath'].'/conf-custom/mail/welcome_email_en.txt');
      } elseif(file_exists($conf['rootpath'].'/conf/mail/welcome_email_'.$conf['language'].'.txt')) {
         $tmp = file($conf['rootpath'].'/conf/mail/welcome_email_'.$conf['language'].'.txt');
         $lines = file($conf['rootpath'].'/conf/mail/welcome_email_'.$conf['language'].'.txt');
      } else {
         $tmp = file($conf['rootpath'].'/conf/mail/welcome_email_en.txt');
         $lines = file($conf['rootpath'].'/conf/mail/welcome_email_en.txt');
      }
      
      $welcome_mail_from  = trim(substr($tmp[0],5));
      $welcome_mail_subject  = trim(substr($tmp[1],8));
      unset($tmp[0]);
      unset($tmp[1]);
      $welcome_mail_message = trim(implode($tmp));
      unset($tmp);
      //* Get from address
      $parts = explode(':',trim($lines[0]));
      unset($parts[0]);
      $welcome_mail_from  = implode(':',$parts);
      unset($lines[0]);
      
      $welcomeFromEmail = $mail_config['admin_mail'];
      $welcomeFromName = $mail_config['admin_name'];
      //* Get subject
      $parts = explode(':',trim($lines[1]));
      unset($parts[0]);
      $welcome_mail_subject  = implode(':',$parts);
      unset($lines[1]);
      //* Get message
      $welcome_mail_message = trim(implode($lines));
      unset($tmp);
      
      $mailHeaders      = "MIME-Version: 1.0" . "\n";
      $mailHeaders     .= "Content-type: text/plain; charset=utf-8" . "\n";
@@ -185,11 +191,9 @@
      $mailHeaders     .= "From: $welcome_mail_from" . "\n";
      $mailHeaders     .= "Reply-To: $welcome_mail_from" . "\n";
      $mailTarget       = $data["new"]["email"];
      // $mailSubject = "=?utf-8?Q?" . imap_8bit($welcome_mail_subject) . "?=";
      $mailSubject      = "=?utf-8?B?".base64_encode($welcome_mail_subject)."?=";
      mail($mailTarget, $mailSubject, $welcome_mail_message, $mailHeaders);
      
   }