コード例 #1
0
 /**
  * Adds To-header and recipient, $email can be an array, or a single string address
  *
  * @param string|array $email
  * @param string $name
  * @param boolean $bounce When true the e-mail is bounced to the from address, when omitted bounce is read from project settings
  * @return \Zend_Mail Provides fluent interface
  */
 public function addTo($email, $name = '', $bounce = null)
 {
     if (is_null($bounce)) {
         $bounce = $this->bounceCheck();
     }
     if ($bounce === true) {
         $name = str_replace('@', ' at ', $email);
         if (is_array($email)) {
             $name = array_shift($name);
             if (count($email) > 1) {
                 $name .= ' & ' . (count($email) - 1) . ' addresses';
             }
         }
         $email = $this->getFrom();
         if (!$email) {
             throw new \Gems_Exception_Coding('Adding bounce To address while From is not set.');
         }
     }
     return parent::addTo($email, $name);
 }
コード例 #2
0
ファイル: MonitorJob.php プロジェクト: GemsTracker/MUtil
 /**
  * Send the actual mail
  *
  * @param string $subject
  * @param string $message BB Code message
  */
 private function _sentMail($subject, $message)
 {
     // Send a seperate mail to each recipient, otherwise they might do nothing
     foreach ($this->to as $to) {
         $mail = new \MUtil_Mail();
         $mail->addTo($to);
         if ($this->from) {
             $mail->setFrom($this->from);
         } else {
             $mail->setFromToDefaultFrom();
         }
         $replacements = $this->getMailVariables();
         $mail->setSubject(strtr($subject, $replacements));
         $mail->setBodyBBCode(strtr($message, $replacements));
         $mail->send();
     }
 }