« ローカル環境で Ethna_MailSender を使う その2 | メイン | ローカル環境で Ethna_MailSender を使う その4 »

ethna

ローカル環境で Ethna_MailSender を使う その3

環境によって、Ethna_MailSender::send()する度に、
    mb_internal_encoding( 'EUC-JP' );
    mb_language( 'japanese' );
    $mailSender =& new Ethna_MailSender( $this->backend );
    if( isset( $this->cfg['DEFINE']['MAIL']['SENDER'] ) ){
        $mailSender->setOption( '-f YahooAuctions@remix.asia' . "\r\n" );
    }
などと初期化するところを継承で
    $mailSender =& new myMailSender( $this->backend );
だけにするには
APPID_ActionClass.php

require_once 'myMailSender.php';
を追加。コンストラクタで
class APPID_MailSender extends Ethna_MailSender{
    function myMailSender( &$backend ){
        mb_internal_encoding( 'EUC-JP' );
        mb_language( 'japanese' );
        
        parent::Ethna_MailSender( $backend );
        
        $config =& $backend->getConfig();
        $this->cfg    = $config->get();    /// 参照渡しはPHP4NOTICE
        
        if( isset( $this->cfg['MAILSENDER'] ) ){
            $this->setOption( "-f {$this->cfg['MAILSENDER']}\r\n" );
            $backend->log( LOG_DEBUG, 'setOption(%s)', $this->option );
        }
    }
}
APPID-ini,php で、必要に応じ 'MAILSENDER' を設定。

トラックバック

このエントリーのトラックバックURL:
https://www.remix.asia/cgi/mt/mt-tb.cgi/6680

コメントを投稿

(いままで、ここでコメントしたことがないときは、コメントを表示する前にこのブログのオーナーの承認が必要になることがあります。承認されるまではコメントは表示されません。そのときはしばらく待ってください。)