/**
  * Build the body of the message in the appropriate format.
  * @private
  * @returns void
  */
 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;
 }
Example #2
0
 /**
  * Build the body of the message in the appropriate format.
  * @private
  * @returns void
  */
 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;
 }
Example #3
0
                    $mime_type = "application/pdf";
                    break;
                case "tif":
                    $mime_type = "image/tiff";
                    break;
                case "tiff":
                    $mime_type = "image/tiff";
                    break;
                default:
                    $mime_type = "binary/octet-stream";
                    break;
            }
            //add an attachment
            $mail->AddStringAttachment($parts_array["Body"], $file, $encoding, $mime_type);
            if (function_exists(get_transcription)) {
                $attachments_array = $mail->GetAttachments();
                $transcription = get_transcription($attachments_array[0]);
                echo "Transcription: " . $transcription;
            } else {
                $transcription = '';
            }
        }
    }
}
//add the body to the email
$body_plain = rip_tags($body);
//echo "body_plain = $body_plain\n";
if (substr($body, 0, 5) == "<html" || substr($body, 0, 9) == "<!doctype") {
    $mail->ContentType = "text/html";
    $mail->Body = $body . "<br><br>" . nl2br($transcription);
    $mail->AltBody = $body_plain . "\n\n{$transcription}";