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

Return the array of attachments.
public getAttachments ( ) : array
Результат array
Пример #1
0
 /**
  * Build the body of the message in the appropriate format.
  * @private
  * @returns void
  */
 public function buildBody()
 {
     $this->CheckChanges();
     // Determine line endings for message
     if ($this->Mail->ContentType == "text/html" || strlen($this->Mail->AltBody) > 0) {
         $eol = "<br/>";
         $bullet = "<li>";
         $bullet_start = "<ul>";
         $bullet_end = "</ul>";
     } else {
         $eol = "\n";
         $bullet = " - ";
         $bullet_start = "";
         $bullet_end = "";
     }
     $ReportBody = "";
     $ReportBody .= "---------------------" . $eol;
     $ReportBody .= "Unit Test Information" . $eol;
     $ReportBody .= "---------------------" . $eol;
     $ReportBody .= "phpmailer version: " . $this->Mail->Version . $eol;
     $ReportBody .= "Content Type: " . $this->Mail->ContentType . $eol;
     if (strlen($this->Mail->Host) > 0) {
         $ReportBody .= "Host: " . $this->Mail->Host . $eol;
     }
     // If attachments then create an attachment list
     $attachments = $this->Mail->getAttachments();
     if (count($attachments) > 0) {
         $ReportBody .= "Attachments:" . $eol;
         $ReportBody .= $bullet_start;
         foreach ($attachments as $attachment) {
             $ReportBody .= $bullet . "Name: " . $attachment[1] . ", ";
             $ReportBody .= "Encoding: " . $attachment[3] . ", ";
             $ReportBody .= "Type: " . $attachment[4] . $eol;
         }
         $ReportBody .= $bullet_end . $eol;
     }
     // If there are changes then list them
     if (count($this->ChangeLog) > 0) {
         $ReportBody .= "Changes" . $eol;
         $ReportBody .= "-------" . $eol;
         $ReportBody .= $bullet_start;
         for ($i = 0; $i < count($this->ChangeLog); $i++) {
             $ReportBody .= $bullet . $this->ChangeLog[$i][0] . " was changed to [" . $this->ChangeLog[$i][1] . "]" . $eol;
         }
         $ReportBody .= $bullet_end . $eol . $eol;
     }
     // If there are notes then list them
     if (count($this->NoteLog) > 0) {
         $ReportBody .= "Notes" . $eol;
         $ReportBody .= "-----" . $eol;
         $ReportBody .= $bullet_start;
         for ($i = 0; $i < count($this->NoteLog); $i++) {
             $ReportBody .= $bullet . $this->NoteLog[$i] . $eol;
         }
         $ReportBody .= $bullet_end;
     }
     // Re-attach the original body
     $this->Mail->Body .= $eol . $eol . $ReportBody;
 }
Пример #2
0
 /**
  * Build the body of the message in the appropriate format.
  *
  * @private
  *
  * @return void
  */
 public function buildBody()
 {
     $this->checkChanges();
     // Determine line endings for message
     if ($this->Mail->ContentType == 'text/html' || strlen($this->Mail->AltBody) > 0) {
         $eol = '<br/>';
         $bullet = '<li>';
         $bullet_start = '<ul>';
         $bullet_end = '</ul>';
     } else {
         $eol = "\n";
         $bullet = ' - ';
         $bullet_start = '';
         $bullet_end = '';
     }
     $ReportBody = '';
     $ReportBody .= '---------------------' . $eol;
     $ReportBody .= 'Unit Test Information' . $eol;
     $ReportBody .= '---------------------' . $eol;
     $ReportBody .= 'phpmailer version: ' . $this->Mail->Version . $eol;
     $ReportBody .= 'Content Type: ' . $this->Mail->ContentType . $eol;
     if (strlen($this->Mail->Host) > 0) {
         $ReportBody .= 'Host: ' . $this->Mail->Host . $eol;
     }
     // If attachments then create an attachment list
     $attachments = $this->Mail->getAttachments();
     if (count($attachments) > 0) {
         $ReportBody .= 'Attachments:' . $eol;
         $ReportBody .= $bullet_start;
         foreach ($attachments as $attachment) {
             $ReportBody .= $bullet . 'Name: ' . $attachment[1] . ', ';
             $ReportBody .= 'Encoding: ' . $attachment[3] . ', ';
             $ReportBody .= 'Type: ' . $attachment[4] . $eol;
         }
         $ReportBody .= $bullet_end . $eol;
     }
     // If there are changes then list them
     if (count($this->ChangeLog) > 0) {
         $ReportBody .= 'Changes' . $eol;
         $ReportBody .= '-------' . $eol;
         $ReportBody .= $bullet_start;
         for ($i = 0; $i < count($this->ChangeLog); $i++) {
             $ReportBody .= $bullet . $this->ChangeLog[$i][0] . ' was changed to [' . $this->ChangeLog[$i][1] . ']' . $eol;
         }
         $ReportBody .= $bullet_end . $eol . $eol;
     }
     // If there are notes then list them
     if (count($this->NoteLog) > 0) {
         $ReportBody .= 'Notes' . $eol;
         $ReportBody .= '-----' . $eol;
         $ReportBody .= $bullet_start;
         for ($i = 0; $i < count($this->NoteLog); $i++) {
             $ReportBody .= $bullet . $this->NoteLog[$i] . $eol;
         }
         $ReportBody .= $bullet_end;
     }
     // Re-attach the original body
     $this->Mail->Body .= $eol . $eol . $ReportBody;
 }
Пример #3
0
         }
         if (!($handle = fopen($temp_file, 'a'))) {
             echo "[!] attachment_error. Cannot open file ({$temp_file})";
             die(503);
         }
         if (fwrite($handle, $attachment) === false) {
             echo "[!] attachment_error. Cannot write to file ({$temp_file})";
             die(504);
         }
         echo "[+] Success, wrote attachment file to {$temp_file}\n";
         fclose($handle);
     }
     if ($mail->addAttachment($temp_file, $task_config['attachment_filename']) !== false) {
         if ($debug) {
             echo "[+] Attachment added success\n";
             echo "[ ] " . var_export($mail->getAttachments(), true) . "\n";
         } else {
             echo "[-] Attachment added fail\n";
             die;
         }
     }
 }
 $send_count = 0;
 foreach ($mailsChunks as $k => $recipients) {
     foreach ($recipients as $rk => $rv) {
         //macros map
         $to_keys = explode(',', $task_config['to_format']);
         $to_keys = array_map("trim", $to_keys);
         $to_values = explode('|', $rv);
         $to_values = array_map("trim", $to_values);
         if (count($to_keys) !== count($to_values)) {