コード例 #1
0
ファイル: modMailTest.php プロジェクト: rosstimson/revolution
 /**
  * @param string $k
  * @param mixed $v
  * @dataProvider providerGet
  * @depends testSet
  */
 public function testGet($k, $v)
 {
     $this->mail->set($k, $v);
     $result = $this->mail->get($k);
     $this->assertEquals($v, $result);
 }
コード例 #2
0
 /**
  * Sets a PHPMailer attribute corresponding to the modX::MAIL_* constants or
  * a custom key.
  *
  * @param string $key The attribute key to set
  * @param mixed $value The value to set
  */
 public function set($key, $value)
 {
     parent::set($key, $value);
     switch ($key) {
         case modMail::MAIL_BODY:
             $this->mailer->Body = $this->attributes[$key];
             break;
         case modMail::MAIL_BODY_TEXT:
             $this->mailer->AltBody = $this->attributes[$key];
             break;
         case modMail::MAIL_CHARSET:
             $this->mailer->CharSet = $this->attributes[$key];
             break;
         case modMail::MAIL_CONTENT_TYPE:
             $this->mailer->ContentType = $this->attributes[$key];
             break;
         case modMail::MAIL_ENCODING:
             $this->mailer->Encoding = $this->attributes[$key];
             break;
         case modMail::MAIL_ENGINE:
             $this->mailer->Mailer = $this->attributes[$key];
             break;
         case modMail::MAIL_ENGINE_PATH:
             $this->mailer->Sendmail = $this->attributes[$key];
             break;
         case modMail::MAIL_FROM:
             $this->mailer->From = $this->attributes[$key];
             $this->mailer->Sender = $this->attributes[$key];
             break;
         case modMail::MAIL_FROM_NAME:
             $this->mailer->FromName = $this->attributes[$key];
             break;
         case modMail::MAIL_HOSTNAME:
             $this->mailer->Hostname = $this->attributes[$key];
             break;
         case modMail::MAIL_LANGUAGE:
             $this->mailer->SetLanguage($this->attributes[$key]);
             break;
         case modMail::MAIL_PRIORITY:
             $this->mailer->Priority = $this->attributes[$key];
             break;
         case modMail::MAIL_READ_TO:
             $this->mailer->ConfirmReadingTo = $this->attributes[$key];
             break;
         case modMail::MAIL_SENDER:
             $this->mailer->Sender = $this->attributes[$key];
             break;
         case modMail::MAIL_SMTP_AUTH:
             $this->mailer->SMTPAuth = $this->attributes[$key];
             break;
         case modMail::MAIL_SMTP_HELO:
             $this->mailer->Helo = $this->attributes[$key];
             break;
         case modMail::MAIL_SMTP_HOSTS:
             $this->mailer->Host = $this->attributes[$key];
             break;
         case modMail::MAIL_SMTP_KEEPALIVE:
             $this->mailer->SMTPKeepAlive = $this->attributes[$key];
             break;
         case modMail::MAIL_SMTP_PASS:
             $this->mailer->Password = $this->attributes[$key];
             break;
         case modMail::MAIL_SMTP_PORT:
             $this->mailer->Port = $this->attributes[$key];
             break;
         case modMail::MAIL_SMTP_PREFIX:
             $this->mailer->SMTPSecure = $this->attributes[$key];
             break;
         case modMail::MAIL_SMTP_SINGLE_TO:
             $this->mailer->SingleTo = $this->attributes[$key];
             break;
         case modMail::MAIL_SMTP_TIMEOUT:
             $this->mailer->Timeout = $this->attributes[$key];
             break;
         case modMail::MAIL_SMTP_USER:
             $this->mailer->Username = $this->attributes[$key];
             break;
         case modMail::MAIL_SUBJECT:
             $this->mailer->Subject = $this->attributes[$key];
             break;
         default:
             $this->modx->log(modX::LOG_LEVEL_WARN, $this->modx->lexicon('mail_err_attr_nv', array('attr' => $key)));
             break;
     }
 }