OSDN Git Service

SMTP送信の修正
authorCake <cake_67@users.sourceforge.jp>
Mon, 5 Jul 2010 04:48:44 +0000 (13:48 +0900)
committerCake <cake_67@users.sourceforge.jp>
Mon, 5 Jul 2010 05:10:48 +0000 (14:10 +0900)
app/config/conf/config.php
app/config/init.php
app/controllers/components/mail.php

index 897b2fb..371e827 100644 (file)
@@ -11,34 +11,31 @@ Configure::write('Config.language', 'jpn');
 
 /* メール送信設定 */
 // SMTP送信する
-Configure::write('Qdmailer', array(
-       'smtp' => false,
-       'smtpLoglevelLink' => false,
-));
+Configure::write('Qdmailer.smtp', false);
+
 // SMTP設定
 // SMTP AUTH(認証が必要)
-Configure::write('Qdmailer', array('smtpServer' => array(
+Configure::write('Qdmailer.smtpServer', array(
        'user' => 'username',
        'pass' => 'password',
        'host' => 'host',
        'port' => 587,
-       'from' => 'from@address',
+       'from' => 'from Address',
        'protocol' => 'SMTP_AUTH',
-)));
-
+));
 // POP Before SMTP(送信前認証が必要)
 /*
-Configure::write('Qdmailer', array('smtpServer' => array(
+Configure::write('Qdmailer.smtpServer', array(
        'user' => 'username',
        'pass' => 'password',
        'host' => 'host',
        'port' => 587,
-       'from' => 'from@address',
+       'from' => 'from Address',
        'protocol'=>'POP_BEFORE',
-       'pop_host' =>'host',
-       'pop_user' => 'username',
-       'pop_pass'=>'password',
-)));
+       'pop_host' =>'pop_host',
+       'pop_user' => 'pop_username',
+       'pop_pass'=> 'pop_password',
+));
 */
 
 /* 
index 2cb946e..10d4e93 100644 (file)
@@ -31,7 +31,8 @@ date_default_timezone_set('Asia/Tokyo');
 Configure::write('Qdmailer', array(
        'is_qmail' => false,
        'smtp' => false,
-       'smtpLoglevelLink' => false,
+       'smtpLoglevelLink' => true,
+       'errorDisplay' => false,
        'logLevel' => 1,
        'logFilename' => 'qdmailer.log',
        'errorlogLevel' => 2,
index 0e676bb..f8ce427 100644 (file)
@@ -12,23 +12,35 @@ class MailComponent  extends QdmailerComponent {
                        return false;
                }
 
+               // SMTP
+               $config = Configure::read('Qdmailer');
+               if ($config['smtp']) {
+                       $this->smtp(true);
+                       $this->smtpServer($config['smtpServer']);
+               }
+
+               // エラー処理
+               $this->errorDisplay(false);
+
                $options = array_merge(array(
-                       'from' => $this->site_configs['Site.adminAddress']['value'],
-                       'replyto' => $this->site_configs['Site.adminAddress']['value'],
+                       'from' => Configure::read('Site.adminAddress'),
+                       'replyto' => Configure::read('Site.adminAddress'),
+                       'mtaOption' => '-f '.Configure::read('Site.adminAddress'),
                        'cc' => '',
                        'bcc' => '',
-                       'mtaOption' => '-f '.$this->site_configs['Site.adminAddress']['value'],
                ), $options);
 
-               $this->to($to, 'Recipient Name');
-               $this->from($options['from'], 'Sender Name');
+               $this->to($to);
+               $this->from($options['from']);
                $this->replyto($options['replyto']);
+               $this->mtaOption($options['mtaOption']);
                if (!empty($options['cc'])) {
                        $this->cc($options['bcc']); 
                }
                if (!empty($options['bcc'])) {
                        $this->bcc($options['bcc']); 
                }
+               $this->kana(true);
                $this->subject($subject);
                $this->cakeText($body);