diff options
author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2007-10-12 16:21:15 +0000 |
---|---|---|
committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2007-10-12 16:21:15 +0000 |
commit | 3a4570b0fc8b3d6339bef71d17d7701554e0bbf7 (patch) | |
tree | 2a06e5261263c68d8afd95a6328879dc289cb909 /wp-includes/class-phpmailer.php | |
parent | b83c34a7010faee0223f6037025c350da12e05e6 (diff) | |
download | wordpress-mu-3a4570b0fc8b3d6339bef71d17d7701554e0bbf7.tar.gz wordpress-mu-3a4570b0fc8b3d6339bef71d17d7701554e0bbf7.tar.xz wordpress-mu-3a4570b0fc8b3d6339bef71d17d7701554e0bbf7.zip |
Merge with WP 2.3 - testing use only!
Move pluggable functions out of wpmu-functions and into pluggable.php, fixes #439
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1069 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes/class-phpmailer.php')
-rw-r--r-- | wp-includes/class-phpmailer.php | 190 |
1 files changed, 95 insertions, 95 deletions
diff --git a/wp-includes/class-phpmailer.php b/wp-includes/class-phpmailer.php index 4c93bae..acacabb 100644 --- a/wp-includes/class-phpmailer.php +++ b/wp-includes/class-phpmailer.php @@ -96,7 +96,7 @@ class PHPMailer var $AltBody = ""; /** - * Sets word wrapping on the body of the message to a given number of + * Sets word wrapping on the body of the message to a given number of * characters. * @var int */ @@ -113,10 +113,10 @@ class PHPMailer * @var string */ var $Sendmail = "/usr/sbin/sendmail"; - + /** - * Path to PHPMailer plugins. This is now only useful if the SMTP class - * is in a different directory than the PHP include path. + * Path to PHPMailer plugins. This is now only useful if the SMTP class + * is in a different directory than the PHP include path. * @var string */ var $PluginDir = ""; @@ -186,7 +186,7 @@ class PHPMailer var $Password = ""; /** - * Sets the SMTP server timeout in seconds. This function will not + * Sets the SMTP server timeout in seconds. This function will not * work with the win32 version. * @var int */ @@ -199,9 +199,9 @@ class PHPMailer var $SMTPDebug = false; /** - * Prevents the SMTP connection from being closed after each mail - * sending. If this is set to true then to close the connection - * requires an explicit call to SmtpClose(). + * Prevents the SMTP connection from being closed after each mail + * sending. If this is set to true then to close the connection + * requires an explicit call to SmtpClose(). * @var bool */ var $SMTPKeepAlive = false; @@ -222,13 +222,13 @@ class PHPMailer var $error_count = 0; var $LE = "\n"; /**#@-*/ - + ///////////////////////////////////////////////// // VARIABLE METHODS ///////////////////////////////////////////////// /** - * Sets message type to HTML. + * Sets message type to HTML. * @param bool $bool * @return void */ @@ -264,7 +264,7 @@ class PHPMailer } /** - * Sets Mailer to send message using the qmail MTA. + * Sets Mailer to send message using the qmail MTA. * @return void */ function IsQmail() { @@ -278,7 +278,7 @@ class PHPMailer ///////////////////////////////////////////////// /** - * Adds a "To" address. + * Adds a "To" address. * @param string $address * @param string $name * @return void @@ -292,7 +292,7 @@ class PHPMailer /** * Adds a "Cc" address. Note: this function works * with the SMTP mailer on win32, not with the "mail" - * mailer. + * mailer. * @param string $address * @param string $name * @return void @@ -306,7 +306,7 @@ class PHPMailer /** * Adds a "Bcc" address. Note: this function works * with the SMTP mailer on win32, not with the "mail" - * mailer. + * mailer. * @param string $address * @param string $name * @return void @@ -318,7 +318,7 @@ class PHPMailer } /** - * Adds a "Reply-to" address. + * Adds a "Reply-to" address. * @param string $address * @param string $name * @return void @@ -337,7 +337,7 @@ class PHPMailer /** * Creates message and assigns Mailer. If the message is * not sent successfully then it returns false. Use the ErrorInfo - * variable to view description of the error. + * variable to view description of the error. * @return bool */ function Send() { @@ -382,9 +382,9 @@ class PHPMailer return $result; } - + /** - * Sends mail using the $Sendmail program. + * Sends mail using the $Sendmail program. * @access private * @return bool */ @@ -402,7 +402,7 @@ class PHPMailer fputs($mail, $header); fputs($mail, $body); - + $result = pclose($mail) >> 8 & 0xFF; if($result != 0) { @@ -414,7 +414,7 @@ class PHPMailer } /** - * Sends mail using the PHP mail() function. + * Sends mail using the PHP mail() function. * @access private * @return bool */ @@ -431,7 +431,7 @@ class PHPMailer $old_from = ini_get("sendmail_from"); ini_set("sendmail_from", $this->Sender); $params = sprintf("-oi -f %s", $this->Sender); - $rt = @mail($to, $this->EncodeHeader($this->Subject), $body, + $rt = @mail($to, $this->EncodeHeader($this->Subject), $body, $header, $params); } else @@ -457,7 +457,7 @@ class PHPMailer * @return bool */ function SmtpSend($header, $body) { - include_once($this->PluginDir . "class.smtp.php"); + include_once($this->PluginDir . "class-smtp.php"); $error = ""; $bad_rcpt = array(); @@ -518,7 +518,7 @@ class PHPMailer } /** - * Initiates a connection to an SMTP server. Returns false if the + * Initiates a connection to an SMTP server. Returns false if the * operation failed. * @access private * @return bool @@ -529,7 +529,7 @@ class PHPMailer $this->smtp->do_debug = $this->SMTPDebug; $hosts = explode(";", $this->Host); $index = 0; - $connection = ($this->smtp->Connected()); + $connection = ($this->smtp->Connected()); // Retry while there is no connection while($index < count($hosts) && $connection == false) @@ -548,10 +548,10 @@ class PHPMailer $this->smtp->Hello($this->Helo); else $this->smtp->Hello($this->ServerHostname()); - + if($this->SMTPAuth) { - if(!$this->smtp->Authenticate($this->Username, + if(!$this->smtp->Authenticate($this->Username, $this->Password)) { $this->SetError($this->Lang("authenticate")); @@ -585,7 +585,7 @@ class PHPMailer } /** - * Sets the language for all class error messages. Returns false + * Sets the language for all class error messages. Returns false * if it cannot load the language file. The default language type * is English. * @param string $lang_type Type of language (e.g. Portuguese: "br") @@ -604,7 +604,7 @@ class PHPMailer return false; } $this->language = $PHPMAILER_LANG; - + return true; } @@ -613,7 +613,7 @@ class PHPMailer ///////////////////////////////////////////////// /** - * Creates recipient headers. + * Creates recipient headers. * @access private * @return string */ @@ -629,9 +629,9 @@ class PHPMailer return $addr_str; } - + /** - * Formats an address correctly. + * Formats an address correctly. * @access private * @return string */ @@ -640,7 +640,7 @@ class PHPMailer $formatted = $addr[0]; else { - $formatted = $this->EncodeHeader($addr[1], 'phrase') . " <" . + $formatted = $this->EncodeHeader($addr[1], 'phrase') . " <" . $addr[0] . ">"; } @@ -650,7 +650,7 @@ class PHPMailer /** * Wraps message for use with mailers that do not * automatically perform wrapping and for quoted-printable. - * Original written by philippe. + * Original written by philippe. * @access private * @return string */ @@ -712,7 +712,7 @@ class PHPMailer else { $buf_o = $buf; - $buf .= ($e == 0) ? $word : (" " . $word); + $buf .= ($e == 0) ? $word : (" " . $word); if (strlen($buf) > $length and $buf_o != "") { @@ -726,7 +726,7 @@ class PHPMailer return $message; } - + /** * Set the body wrapping. * @access private @@ -735,7 +735,7 @@ class PHPMailer function SetWordWrap() { if($this->WordWrap < 1) return; - + switch($this->message_type) { case "alt": @@ -750,13 +750,13 @@ class PHPMailer } /** - * Assembles message header. + * Assembles message header. * @access private * @return string */ function CreateHeader() { $result = ""; - + // Set the boundaries $uniq_id = md5(uniqid(time())); $this->boundary[1] = "b1_" . $uniq_id; @@ -767,7 +767,7 @@ class PHPMailer $result .= $this->HeaderLine("Return-Path", trim($this->From)); else $result .= $this->HeaderLine("Return-Path", trim($this->Sender)); - + // To be created automatically by mail() if($this->Mailer != "mail") { @@ -782,7 +782,7 @@ class PHPMailer $from = array(); $from[0][0] = trim($this->From); $from[0][1] = $this->FromName; - $result .= $this->AddrAppend("From", $from); + $result .= $this->AddrAppend("From", $from); // sendmail and mail() extract Bcc from the header before sending if((($this->Mailer == "sendmail") || ($this->Mailer == "mail")) && (count($this->bcc) > 0)) @@ -797,17 +797,17 @@ class PHPMailer $result .= sprintf("Message-ID: <%s@%s>%s", $uniq_id, $this->ServerHostname(), $this->LE); $result .= $this->HeaderLine("X-Priority", $this->Priority); - + if($this->ConfirmReadingTo != "") { - $result .= $this->HeaderLine("Disposition-Notification-To", + $result .= $this->HeaderLine("Disposition-Notification-To", "<" . trim($this->ConfirmReadingTo) . ">"); } // Add custom headers for($index = 0; $index < count($this->CustomHeader); $index++) { - $result .= $this->HeaderLine(trim($this->CustomHeader[$index][0]), + $result .= $this->HeaderLine(trim($this->CustomHeader[$index][0]), $this->EncodeHeader(trim($this->CustomHeader[$index][1]))); } $result .= $this->HeaderLine("MIME-Version", "1.0"); @@ -824,8 +824,8 @@ class PHPMailer case "alt_attachments": if($this->InlineImageExists()) { - $result .= sprintf("Content-Type: %s;%s\ttype=\"text/html\";%s\tboundary=\"%s\"%s", - "multipart/related", $this->LE, $this->LE, + $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 @@ -859,16 +859,16 @@ class PHPMailer switch($this->message_type) { case "alt": - $result .= $this->GetBoundary($this->boundary[1], "", + $result .= $this->GetBoundary($this->boundary[1], "", "text/plain", ""); $result .= $this->EncodeString($this->AltBody, $this->Encoding); $result .= $this->LE.$this->LE; - $result .= $this->GetBoundary($this->boundary[1], "", + $result .= $this->GetBoundary($this->boundary[1], "", "text/html", ""); - + $result .= $this->EncodeString($this->Body, $this->Encoding); $result .= $this->LE.$this->LE; - + $result .= $this->EndBoundary($this->boundary[1]); break; case "plain": @@ -878,32 +878,32 @@ class PHPMailer $result .= $this->GetBoundary($this->boundary[1], "", "", ""); $result .= $this->EncodeString($this->Body, $this->Encoding); $result .= $this->LE; - + $result .= $this->AttachAll(); break; case "alt_attachments": $result .= sprintf("--%s%s", $this->boundary[1], $this->LE); $result .= sprintf("Content-Type: %s;%s" . "\tboundary=\"%s\"%s", - "multipart/alternative", $this->LE, + "multipart/alternative", $this->LE, $this->boundary[2], $this->LE.$this->LE); - + // Create text body - $result .= $this->GetBoundary($this->boundary[2], "", + $result .= $this->GetBoundary($this->boundary[2], "", "text/plain", "") . $this->LE; $result .= $this->EncodeString($this->AltBody, $this->Encoding); $result .= $this->LE.$this->LE; - + // Create the HTML body - $result .= $this->GetBoundary($this->boundary[2], "", + $result .= $this->GetBoundary($this->boundary[2], "", "text/html", "") . $this->LE; - + $result .= $this->EncodeString($this->Body, $this->Encoding); $result .= $this->LE.$this->LE; $result .= $this->EndBoundary($this->boundary[2]); - + $result .= $this->AttachAll(); break; } @@ -924,23 +924,23 @@ class PHPMailer if($encoding == "") { $encoding = $this->Encoding; } $result .= $this->TextLine("--" . $boundary); - $result .= sprintf("Content-Type: %s; charset = \"%s\"", + $result .= sprintf("Content-Type: %s; charset = \"%s\"", $contentType, $charSet); $result .= $this->LE; $result .= $this->HeaderLine("Content-Transfer-Encoding", $encoding); $result .= $this->LE; - + return $result; } - + /** * Returns the end of a message boundary. * @access private */ function EndBoundary($boundary) { - return $this->LE . "--" . $boundary . "--" . $this->LE; + return $this->LE . "--" . $boundary . "--" . $this->LE; } - + /** * Sets the message type. * @access private @@ -992,7 +992,7 @@ class PHPMailer * @param string $type File extension (MIME) type. * @return bool */ - function AddAttachment($path, $name = "", $encoding = "base64", + function AddAttachment($path, $name = "", $encoding = "base64", $type = "application/octet-stream") { if(!@is_file($path)) { @@ -1043,7 +1043,7 @@ class PHPMailer $type = $this->attachment[$i][4]; $disposition = $this->attachment[$i][6]; $cid = $this->attachment[$i][7]; - + $mime[] = sprintf("--%s%s", $this->boundary[1], $this->LE); $mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $name, $this->LE); $mime[] = sprintf("Content-Transfer-Encoding: %s%s", $encoding, $this->LE); @@ -1051,7 +1051,7 @@ class PHPMailer if($disposition == "inline") $mime[] = sprintf("Content-ID: <%s>%s", $cid, $this->LE); - $mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", + $mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", $disposition, $name, $this->LE.$this->LE); // Encode as string attachment @@ -1063,7 +1063,7 @@ class PHPMailer } else { - $mime[] = $this->EncodeFile($path, $encoding); + $mime[] = $this->EncodeFile($path, $encoding); if($this->IsError()) { return ""; } $mime[] = $this->LE.$this->LE; } @@ -1073,7 +1073,7 @@ class PHPMailer return join("", $mime); } - + /** * Encodes attachment in requested format. Returns an * empty string on failure. @@ -1129,13 +1129,13 @@ class PHPMailer } /** - * Encode a header string to best of Q, B, quoted or none. + * Encode a header string to best of Q, B, quoted or none. * @access private * @return string */ function EncodeHeader ($str, $position = 'text') { $x = 0; - + switch (strtolower($position)) { case 'phrase': if (!preg_match('/[\200-\377]/', $str)) { @@ -1177,12 +1177,12 @@ class PHPMailer $encoded = preg_replace('/^(.*)$/m', " =?".$this->CharSet."?$encoding?\\1?=", $encoded); $encoded = trim(str_replace("\n", $this->LE, $encoded)); - + return $encoded; } - + /** - * Encode string to quoted-printable. + * Encode string to quoted-printable. * @access private * @return string */ @@ -1205,7 +1205,7 @@ class PHPMailer } /** - * Encode string to q encoding. + * Encode string to q encoding. * @access private * @return string */ @@ -1226,7 +1226,7 @@ class PHPMailer "'='.sprintf('%02X', ord('\\1'))", $encoded); break; } - + // Replace every spaces to _ (more readable than =20) $encoded = str_replace(" ", "_", $encoded); @@ -1243,7 +1243,7 @@ class PHPMailer * @param string $type File extension (MIME) type. * @return void */ - function AddStringAttachment($string, $filename, $encoding = "base64", + function AddStringAttachment($string, $filename, $encoding = "base64", $type = "application/octet-stream") { // Append to $attachment array $cur = count($this->attachment); @@ -1256,23 +1256,23 @@ class PHPMailer $this->attachment[$cur][6] = "attachment"; $this->attachment[$cur][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 - * image type. For JPEG images use "image/jpeg" and for GIF images + * Adds an embedded attachment. This can include images, sounds, and + * just about any other document. Make sure to set the $type to an + * image type. For JPEG images use "image/jpeg" and for GIF images * use "image/gif". * @param string $path Path to the attachment. - * @param string $cid Content ID of the attachment. Use this to identify + * @param string $cid Content ID of the attachment. Use this to identify * the Id for accessing the image in an HTML form. * @param string $name Overrides the attachment name. * @param string $encoding File encoding (see $Encoding). - * @param string $type File extension (MIME) type. + * @param string $type File extension (MIME) type. * @return bool */ - function AddEmbeddedImage($path, $cid, $name = "", $encoding = "base64", + function AddEmbeddedImage($path, $cid, $name = "", $encoding = "base64", $type = "application/octet-stream") { - + if(!@is_file($path)) { $this->SetError($this->Lang("file_access") . $path); @@ -1293,10 +1293,10 @@ class PHPMailer $this->attachment[$cur][5] = false; // isStringAttachment $this->attachment[$cur][6] = "inline"; $this->attachment[$cur][7] = $cid; - + return true; } - + /** * Returns true if an inline attachment is present. * @access private @@ -1312,7 +1312,7 @@ class PHPMailer break; } } - + return $result; } @@ -1397,7 +1397,7 @@ class PHPMailer } /** - * Returns the proper RFC 822 formatted date. + * Returns the proper RFC 822 formatted date. * @access private * @return string */ @@ -1410,10 +1410,10 @@ class PHPMailer return $result; } - + /** - * Returns the appropriate server variable. Should work with both - * PHP 4.1.0+ as well as older versions. Returns an empty string + * Returns the appropriate server variable. Should work with both + * PHP 4.1.0+ as well as older versions. Returns an empty string * if nothing is found. * @access private * @return mixed @@ -1428,7 +1428,7 @@ class PHPMailer if(!isset($_SERVER["REMOTE_ADDR"])) $_SERVER = $HTTP_ENV_VARS; // must be Apache } - + if(isset($_SERVER[$varName])) return $_SERVER[$varName]; else @@ -1459,13 +1459,13 @@ class PHPMailer function Lang($key) { if(count($this->language) < 1) $this->SetLanguage("en"); // set the default language - + if(isset($this->language[$key])) return $this->language[$key]; else return "Language string failed to load: " . $key; } - + /** * Returns true if an error occurred. * @return bool @@ -1475,7 +1475,7 @@ class PHPMailer } /** - * Changes every end of line from CR or LF to CRLF. + * Changes every end of line from CR or LF to CRLF. * @access private * @return string */ @@ -1487,7 +1487,7 @@ class PHPMailer } /** - * Adds a custom header. + * Adds a custom header. * @return void */ function AddCustomHeader($custom_header) { |