Exemplo n.º 1
0
 /**
  * Adds an address to the mailer
  *
  * @param string $type The type of address (to, reply-to, bcc, cc)
  * @param string $email The email address to address to
  * @param string $name The name of the email address
  * @return boolean True if was addressed
  */
 public function address($type, $email, $name = '')
 {
     $set = false;
     if ($email) {
         $set = parent::address($type, $email, $name);
         if ($set) {
             $type = strtolower($type);
             switch ($type) {
                 case 'to':
                     $this->mailer->AddAddress($email, $name);
                     break;
                 case 'cc':
                     $this->mailer->AddCC($email, $name);
                     break;
                 case 'bcc':
                     $this->mailer->AddBCC($email, $name);
                     break;
                 case 'reply-to':
                     $this->mailer->AddReplyTo($email, $name);
                     break;
             }
         }
     } elseif ($email === null) {
         $this->modx->log(modX::LOG_LEVEL_ERROR, $this->modx->lexicon('mail_err_unset_spec'));
     } else {
         $this->modx->log(modX::LOG_LEVEL_ERROR, $this->modx->lexicon('mail_err_address_ns'));
     }
     return $set;
 }