Ejemplo n.º 1
0
 public function send()
 {
     $aRecipients = array();
     foreach ($this->aRecipients as $sAddress => $sName) {
         $aRecipients[] = $this->getAddressToken($sName, $sAddress);
     }
     $sRecipients = implode(', ', $aRecipients);
     if ($this->oContent instanceof Template) {
         $this->oContent = MIMELeaf::leafWithTemplate($this->oContent, $this->sMimeType, '8bit', null, null, $this->sCharset);
     }
     foreach ($this->aCarbonCopyRecipients as $sAddress => $sName) {
         $this->oContent->addToHeader("Cc", $this->getAddressToken($sName, $sAddress));
     }
     foreach ($this->aBlindCarbonCopyRecipients as $sAddress => $sName) {
         $this->oContent->addToHeader("Bcc", $this->getAddressToken($sName, $sAddress));
     }
     if ($this->sReplyTo !== null) {
         $this->oContent->setHeader("Reply-To", $this->sReplyTo);
     }
     $this->oContent->setHeader('From', $this->getAddressToken($this->sSenderName, $this->sSenderAddress));
     $sSubject = '=?' . Settings::getSetting("encoding", "db", "utf-8") . '?B?' . base64_encode($this->sSubject) . '?=';
     $bResult = $this->sendMail($sRecipients, $sSubject, $this->oContent->getBody(), $this->oContent->getHeaderString());
     if ($bResult === false) {
         throw new Exception("Error in EMail->send(): E-Mail was not accepted for delivery: " . $sRecipients);
     }
 }