예제 #1
0
파일: Email.php 프로젝트: avandrevitor/S9
 /**
  * Envia o Email
  * @return boolean
  */
 public function send()
 {
     try {
         #Definindo Destinatário
         $to = implode(",", $this->getTo()->getArrayCopy());
         #Definindo Headers
         $oItHeaders = $this->getHeaders()->getIterator();
         $headers = "";
         while ($oItHeaders->valid()) {
             $current = $oItHeaders->current();
             if (is_array($current)) {
                 foreach ($current as $k => $item) {
                     $headers .= $k . $item . "\r\n";
                 }
             } else {
                 $headers .= str_replace("[email]", $this->getFrom(), $current) . "\r\n";
             }
             $oItHeaders->next();
         }
         return $this->execute($to, $this->getSubject(), $this->getContent(), $headers);
     } catch (\Exception $oException) {
         Logging::getInstance()->register("S9\\PATTERN\\EMAIL ERROR: [{$oException->getMessage()}]");
         return false;
     }
 }