Changeset 18866


Ignore:
Timestamp:
2010/10/27 00:41:36 (13 years ago)
Author:
Seasoft
Message:

#837(SC_SendMail#sendMail と SC_SendMail#sendHtmlMail で複数宛先の扱い方が異なる)改修

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_5-dev/data/class/SC_SendMail.php

    r18701 r18866  
    247247    } 
    248248     
    249     // 送信先を返す 
     249    /** 
     250     * メーラーバックエンドに応じた送信先を返す 
     251     * 
     252     * @return array|string メーラーバックエンドに応じた送信先 
     253     */ 
    250254    function getRecip() { 
    251255        switch ($this->backend) { 
     256            // PEAR::Mail_mail#send は、(他のメーラーバックエンドと異なり) 第1引数を To: として扱う。Cc: や Bcc: は、ヘッダー情報から処理する。 
    252257        case "mail": 
    253258            return $this->to; 
     
    265270     * 
    266271     * 設定された情報を利用して, メールを送信する. 
    267      * メールの宛先に Cc や Bcc が設定されていた場合は, 宛先ごとに複数回送信を行う. 
    268      * 
    269      * - getRecip() 関数の返り値が配列の場合は, 返り値のメールアドレスごとに, 
    270      *   PEAR::Mail::send() 関数を実行する. 
    271      * - getRecip() 関数の返り値が string の場合は, 返り値のメールアドレスを 
    272      *   RCPT TO: に設定し, PEAR::Mail::send() 関数を実行する. 
    273272     * 
    274273     * @return void 
    275274     */ 
    276     function sendMail() { 
    277         $header = $this->getTEXTHeader(); 
     275    function sendMail($isHtml = false) { 
     276        $header = $isHtml ? $this->getHTMLHeader() : $this->getTEXTHeader(); 
    278277        $recip = $this->getRecip(); 
    279  
    280278        // メール送信 
    281         if (is_array($recip)) { 
    282             foreach ($recip as $rcpt_to) { 
    283                 $results[] = $this->objMail->send($rcpt_to, $header, $this->body); 
    284             } 
    285         } else { 
    286             $results[] = $this->objMail->send($recip, $header, $this->body); 
    287         } 
    288  
    289         $ret = true; 
    290         foreach ($results as $result) { 
     279        $result = $this->objMail->send($recip, $header, $this->body); 
    291280            if (PEAR::isError($result)) { 
    292281                GC_Utils_Ex::gfPrintLog($result->getMessage()); 
    293282                GC_Utils_Ex::gfDebugLog($header); 
    294                 $ret = false; 
     283                return false; 
    295284            } 
    296         } 
    297         return $ret; 
    298     } 
    299  
    300     // HTMLメール送信を実行する 
     285        return true; 
     286    } 
     287 
     288    /** 
     289     * HTMLメール送信を実行する. 
     290     * 
     291     * @return void 
     292     */ 
    301293    function sendHtmlMail() { 
    302         $header = $this->getHTMLHeader(); 
    303         // メール送信 
    304         $result = $this->objMail->send($this->getRecip(), $header, $this->body); 
    305         if (PEAR::isError($result)) { 
    306             GC_Utils_Ex::gfPrintLog($result->getMessage()); 
    307             GC_Utils_Ex::gfDebugLog($header); 
    308             return false; 
    309         } 
    310         return true; 
     294        return($this->sendMail(true)); 
    311295    } 
    312296 
Note: See TracChangeset for help on using the changeset viewer.