upgrade to phpmailer Version 5.1

This commit is contained in:
Klaus Leithoff 2010-04-19 15:05:36 +00:00
parent d4959b0275
commit af0f7d65b7

View File

@ -790,11 +790,6 @@ class PHPMailer {
$host = $hosts[$index];
$port = $this->Port;
}
$hostA = explode("://", $host);
if (strtolower($hostA[0]) == 'tls' || strtolower($hostA[0]) == 'ssl') {
$this->SMTPSecure = strtolower($hostA[0]);
$host = $hostA[1];
}
$tls = ($this->SMTPSecure == 'tls');
$ssl = ($this->SMTPSecure == 'ssl');
@ -1062,7 +1057,6 @@ class PHPMailer {
switch($this->message_type) {
case 'alt':
case 'alt_attachments':
case 'alt_extended':
$this->AltBody = $this->WrapText($this->AltBody, $this->WordWrap);
break;
default:
@ -1168,7 +1162,6 @@ class PHPMailer {
break;
case 'attachments':
case 'alt_attachments':
case 'alt_extended':
if($this->InlineImageExists()){
$result .= sprintf("Content-Type: %s;%s\ttype=\"text/html\";%s\tboundary=\"%s\"%s", 'multipart/related', $this->LE, $this->LE, $this->boundary[1], $this->LE);
} else {
@ -1234,22 +1227,6 @@ class PHPMailer {
$body .= $this->EndBoundary($this->boundary[2]);
$body .= $this->AttachAll();
break;
case 'alt_extended':
$body .= sprintf("--%s%s", $this->boundary[1], $this->LE);
$body .= sprintf("Content-Type: %s;%s" . "\tboundary=\"%s\"%s", 'multipart/alternative', $this->LE, $this->boundary[2], $this->LE.$this->LE);
$body .= $this->GetBoundary($this->boundary[2], '', 'text/plain', '') . $this->LE; // Create text body
$body .= $this->EncodeString($this->AltBody, $this->Encoding);
$body .= $this->LE.$this->LE;
$body .= $this->GetBoundary($this->boundary[2], '', 'text/html', '') . $this->LE; // Create the HTML body
$body .= $this->EncodeString($this->Body, $this->Encoding);
$body .= $this->LE.$this->LE;
// Create the extended body for an attached text/calendar
$body .= $this->GetBoundary($this->boundary[2], '', $this->attachment[0][4], '') . $this->LE;
$body .= $this->EncodeString($this->attachment[0][0], $this->attachment[0][3]);
$body .= $this->LE.$this->LE;
$body .= $this->EndBoundary($this->boundary[2]);
$body .= $this->AttachAll();
break;
}
if ($this->IsError()) {
@ -1295,7 +1272,7 @@ class PHPMailer {
$encoding = $this->Encoding;
}
$result .= $this->TextLine('--' . $boundary);
$result .= sprintf("Content-Type: %s; charset =\"%s\"", $contentType, $charSet);
$result .= sprintf("Content-Type: %s; charset = \"%s\"", $contentType, $charSet);
$result .= $this->LE;
$result .= $this->HeaderLine('Content-Transfer-Encoding', $encoding);
$result .= $this->LE;
@ -1329,9 +1306,6 @@ class PHPMailer {
if(strlen($this->AltBody) > 0 && count($this->attachment) > 0) {
$this->message_type = 'alt_attachments';
}
if(strlen($this->AltBody) > 0 && count($this->attachment) > 0 && stripos($this->attachment[0][4],'text/calendar')!==false) {
$this->message_type = 'alt_extended';
}
}
}
@ -1443,22 +1417,14 @@ class PHPMailer {
$cidUniq[$cid] = true;
$mime[] = sprintf("--%s%s", $this->boundary[1], $this->LE);
if($disposition == 'part') {
$mime[] = sprintf("Content-Type: %s; charset=\"%s\"%s", $type, $this->CharSet, $this->LE);
} else {
$mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $this->EncodeHeader($this->SecureHeader($name)), $this->LE);
}
$mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $this->EncodeHeader($this->SecureHeader($name)), $this->LE);
$mime[] = sprintf("Content-Transfer-Encoding: %s%s", $encoding, $this->LE);
if($disposition == 'inline') {
$mime[] = sprintf("Content-ID: <%s>%s", $cid, $this->LE);
}
if($disposition != "part") {
$mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", $disposition, $this->EncodeHeader($this->SecureHeader($name)), $this->LE.$this->LE);
} else {
$mime[] = sprintf("%s", $this->LE);
}
$mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", $disposition, $this->EncodeHeader($this->SecureHeader($name)), $this->LE.$this->LE);
// Encode as string attachment
if($bString) {
@ -1801,30 +1767,6 @@ class PHPMailer {
);
}
/**
* Adds a string or binary attachment (non-filesystem) to the list.
* This method can be used to attach ascii or binary data,
* such as a BLOB record from a database.
* @param string $string String attachment data.
* @param string $filename Name of the attachment.
* @param string $encoding File encoding (see $Encoding).
* @param string $type File extension (MIME) type.
* @return void
*/
function AddStringPart($string, $filename, $encoding = "base64", $type = "application/octet-stream") {
// Append to $attachment array
$this->attachment[] = array(
0 => $string,
1 => $filename,
2 => $filename,
3 => $encoding,
4 => $type,
5 => true, // isString
6 => "part",
7 => 0
);
}
/**
* Adds an embedded attachment. This can include images, sounds, and
* just about any other document. Make sure to set the $type to an
@ -1953,32 +1895,6 @@ class PHPMailer {
$this->CustomHeader = array();
}
public function getMessageHeader() {
if(!isset($this->sentHeader)) {
// Set whether the message is multipart/alternative
if(!empty($this->AltBody)) $this->ContentType = "multipart/alternative";
$this->SetMessageType();
$header = $this->CreateHeader();
$this->sentHeader = $header;
}
return $this->sentHeader;
}
public function getMessageBody() {
if(!isset($this->sentBody)) {
// Set whether the message is multipart/alternative
if(!empty($this->AltBody)) $this->ContentType = "multipart/alternative";
$this->SetMessageType();
$body = $this->CreateBody();
$this->sentBody = $body;
}
return $this->sentBody;
}
/////////////////////////////////////////////////
// CLASS METHODS, MISCELLANEOUS
/////////////////////////////////////////////////
@ -2401,4 +2317,4 @@ class phpmailerException extends Exception {
return $errorMsg;
}
}
?>
?>