attachFile() публичный Метод

Attach a file
public attachFile ( string $strFile, string $strMime = 'application/octet-stream' )
$strFile string The file path
$strMime string The MIME type (defaults to "application/octet-stream")
Пример #1
0
 /**
  * Generate the e-mail object and return it
  *
  * @param Database\Result|object $objNewsletter
  * @param array                  $arrAttachments
  *
  * @return Email
  */
 protected function generateEmailObject(Database\Result $objNewsletter, $arrAttachments)
 {
     $objEmail = new \Email();
     $objEmail->from = $objNewsletter->sender;
     $objEmail->subject = $objNewsletter->subject;
     // Add sender name
     if ($objNewsletter->senderName != '') {
         $objEmail->fromName = $objNewsletter->senderName;
     }
     $objEmail->embedImages = !$objNewsletter->externalImages;
     $objEmail->logFile = TL_NEWSLETTER . '_' . $objNewsletter->id;
     // Attachments
     if (!empty($arrAttachments) && is_array($arrAttachments)) {
         foreach ($arrAttachments as $strAttachment) {
             $objEmail->attachFile(TL_ROOT . '/' . $strAttachment);
         }
     }
     return $objEmail;
 }