/**
  * Adds $part to the list of parts and returns the Content-ID of the part.
  *
  * @param ezcMailPart $part
  * @return string
  */
 public function addRelatedPart(ezcMailPart $part)
 {
     // it doesn't have a Content-ID, we must set one.
     $contentId = '';
     if ($part->getHeader('Content-ID') == '') {
         if ($part instanceof ezcMailFile) {
             $part->contentId = ezcMailTools::generateContentId(basename($part->fileName));
         } else {
             $part->setHeader('Content-ID', ezcMailTools::generateContentId('part'));
         }
     }
     $contentId = trim($part->getHeader('Content-ID'), '<>');
     // Set the content ID property of the ezcMailFile if one was found
     if ($part instanceof ezcMailFile) {
         $part->contentId = $contentId;
     }
     if (count($this->parts) > 0) {
         $this->parts[] = $part;
     } else {
         $this->parts[1] = $part;
     }
     return $contentId;
 }
Esempio n. 2
0
 /**
  * Returns true if the property $name is set, otherwise false.
  *
  * @param string $name
  * @return bool
  * @ignore
  */
 public function __isset($name)
 {
     switch ($name) {
         case 'mail':
             return isset($this->properties[$name]);
         default:
             return parent::__isset($name);
     }
 }
Esempio n. 3
0
 /**
  * Returns the generated headers for the mail.
  *
  * This method is called automatically when the mail message is built.
  * You can re-implement this method in subclasses if you wish to set
  * different mail headers than ezcMail.
  *
  * @return string
  */
 public function generateHeaders()
 {
     // set our headers first.
     if ($this->from !== null) {
         $this->setHeader("From", ezcMailTools::composeEmailAddress($this->from));
     }
     if ($this->to !== null) {
         $this->setHeader("To", ezcMailTools::composeEmailAddresses($this->to));
     }
     if (count($this->cc)) {
         $this->setHeader("Cc", ezcMailTools::composeEmailAddresses($this->cc));
     }
     if (count($this->bcc)) {
         $this->setHeader("Bcc", ezcMailTools::composeEmailAddresses($this->bcc));
     }
     $this->setHeader('Subject', $this->subject, $this->subjectCharset);
     $this->setHeader('MIME-Version', '1.0');
     $this->setHeader('User-Agent', 'eZ Components');
     $this->setHeader('Date', date('r'));
     $idhost = $this->from != null && $this->from->email != '' ? $this->from->email : 'localhost';
     if (is_null($this->messageId)) {
         $this->setHeader('Message-Id', '<' . ezcMailTools::generateMessageId($idhost) . '>');
     } else {
         $this->setHeader('Message-Id', $this->messageID);
     }
     // if we have a body part, include the headers of the body
     if (is_subclass_of($this->body, "ezcMailPart")) {
         return parent::generateHeaders() . $this->body->generateHeaders();
     }
     return parent::generateHeaders();
 }
Esempio n. 4
0
File: file.php Progetto: kidaa30/yes
 /**
  * Override of the generate() method from ezcMailPart. Used to set headers before
  * generating the part.
  *
  * @return string
  */
 public function generate()
 {
     $this->setHeaderContentType();
     $this->setHeader('Content-Transfer-Encoding', 'base64');
     $this->setHeaderContentDisposition();
     return parent::generate();
 }
Esempio n. 5
0
 /**
  * Returns true if the property $name is set, otherwise false.
  *
  * @param string $name
  * @return bool
  * @ignore
  */
 public function __isset($name)
 {
     switch ($name) {
         case 'boundary':
         case 'noMimeMessage':
             return isset($this->properties[$name]);
         default:
             return parent::__isset($name);
     }
 }
Esempio n. 6
0
 /**
  * Returns the headers set for this part as a RFC822 compliant string.
  *
  * This method does not add the required two lines of space
  * to separate the headers from the body of the part.
  *
  * @see setHeader()
  * @return string
  */
 public function generateHeaders()
 {
     $this->setHeader("Content-Type", "text/" . $this->subType . "; charset=" . $this->charset);
     $this->setHeader("Content-Transfer-Encoding", $this->encoding);
     return parent::generateHeaders();
 }
Esempio n. 7
0
 /**
  * Returns the headers set for this part as a RFC822 compliant string.
  *
  * This method does not add the required two lines of space
  * to separate the headers from the body of the part.
  *
  * @see setHeader()
  * @return string
  */
 public function generateHeaders()
 {
     $this->setHeader("Content-Type", "message/delivery-status");
     return parent::generateHeaders();
 }