解決安裝OS-Commerce UTF-8 版-E-Mail-郵件寄出時的亂碼問題

解決安裝OS-Commerce UTF-8 版-E-Mail-郵件寄出時的亂碼問題

OS-Commercec會員註冊後會寄出一封E-Mail給會員
如果發生【收件人】【主旨】是亂碼(而內容是正常無亂碼
那應該怎樣解決呢?
之前我有修正版oScommerse-2.2_ms2__UTF_8-已修正郵件亂碼版(提供學員下載)
最近又有人學員想嘗試安裝官方:osCommerce v2.2 RC 2 -UFT-8 又碰到一樣的亂碼問題!
問提的解決方法:

開啟:安裝目錄下includesclassesemail.php

尋找程式碼:

    if (is_string($headers)) {
        $headers = explode($this->lf, trim($headers));

前面的程式碼為:

     $to = (($to_name != '') ? '"' . $to_name . '" <' . $to_addr . '>' : $to_addr);
      $from = (($from_name != '') ? '"' . $from_name . '" <' . $from_addr . '>' : $from_addr);

在它改成以下的程式碼:

      $to_name = "=?UTF-8?B?".base64_encode($to_name)."?=";
      $subject = "=?UTF-8?B?".base64_encode($subject)."?=";
      $to = (($to_name != '') ? '"' . $to_name . '" <' . $to_addr . '>' : $to_addr);
      //$from = (($from_name != '') ? '"' . $from_name . '" <' . $from_addr . '>' : $from_addr);
      $from = '"=?UTF-8?B?'.base64_encode(STORE_NAME).'?=" <'.STORE_OWNER_EMAIL_ADDRESS.'>';

備註:請確認一下安裝目錄下includeslanguages chinese.php

程式碼:

// charset for web pages and emails
define('CHARSET', 'UTF-8');