CakePHPコンポーネントとして使う
2008/04/24
単体で使用することもできますし、Qdmailと組み合わせると力をもっと発揮します。
初期設定
/app/controllers/conponents/にファイルを置いてください。
使いたいコントローラーで、
var $conponentes = array( 'Qdsmtp' );とするだけ。
すると
$this->Qdsmtp->mail(・・・・・);とするだけで、標準mail関数を使わない、SMTP送信ができます。
Qdmailと組み合わせて使う
明示的に$conponentes = array( 'Qdsmtp' );としなくても、Qdmailが勝手に読み込んでくれます。*1使用例
$param = array(
'host'=>'pop.example.com',
'port'=>'587',
'from'=>'address@example.com',
'user'=>'postmaster@example.com',
'pass' => 'password',
'protocol'=>'SMTP_AUTH',
);
$this->Qdmail->to('to_address@example.com');
$this->Qdmail->subject('メールのテスト');
$this->Qdmail->from('from@example.com');
$this->Qdmail->smtp(true);
$this->Qdmail->smtpServer($param);
$this->Qdmail -> cakeHtml('本文');
$fg=$this->Qdmail->send();