/*~ class.phpmailer.php
.---------------------------------------------------------------------------.
| Software: PHPMailer - PHP email class |
-| Version: 2.1 |
+| Version: 2.3 |
| Contact: via sourceforge.net support pages (also www.codeworxtech.com) |
| Info: http://phpmailer.sourceforge.net |
| Support: http://sourceforge.net/projects/phpmailer/ |
* Holds PHPMailer version.
* @var string
*/
- public $Version = "2.1";
+ public $Version = "2.3";
/**
* Sets the email address that a reading confirmation will be sent.
*/
public $SingleTo = false;
+ /**
+ * Provides the ability to change the line ending
+ * @var string
+ */
+ public $LE = "\r\n";
+
/////////////////////////////////////////////////
// PROPERTIES, PRIVATE
/////////////////////////////////////////////////
private $boundary = array();
private $language = array();
private $error_count = 0;
- private $LE = "\n";
+ private $sign_cert_file = "";
private $sign_key_file = "";
private $sign_key_pass = "";
if($this->smtp->Connect(($ssl ? 'ssl://':'').$host, $port, $this->Timeout)) {
- $hello = ($this->Helo != '' ? $this->Hello : $this->ServerHostname());
+ $hello = ($this->Helo != '' ? $this->Helo : $this->ServerHostname());
$this->smtp->Hello($hello);
if($tls) {
*/
function SetLanguage($lang_type = 'en', $lang_path = 'language/') {
if( !(@include $lang_path.'phpmailer.lang-'.$lang_type.'.php') ) {
- $this->SetError('Could not load language file');
- return false;
+ $PHPMAILER_LANG = array();
+ $PHPMAILER_LANG["provide_address"] = 'You must provide at least one ' .
+ $PHPMAILER_LANG["mailer_not_supported"] = ' mailer is not supported.';
+ $PHPMAILER_LANG["execute"] = 'Could not execute: ';
+ $PHPMAILER_LANG["instantiate"] = 'Could not instantiate mail function.';
+ $PHPMAILER_LANG["authenticate"] = 'SMTP Error: Could not authenticate.';
+ $PHPMAILER_LANG["from_failed"] = 'The following From address failed: ';
+ $PHPMAILER_LANG["recipients_failed"] = 'SMTP Error: The following ' .
+ $PHPMAILER_LANG["data_not_accepted"] = 'SMTP Error: Data not accepted.';
+ $PHPMAILER_LANG["connect_host"] = 'SMTP Error: Could not connect to SMTP host.';
+ $PHPMAILER_LANG["file_access"] = 'Could not access file: ';
+ $PHPMAILER_LANG["file_open"] = 'File Error: Could not open file: ';
+ $PHPMAILER_LANG["encoding"] = 'Unknown encoding: ';
+ $PHPMAILER_LANG["signing"] = 'Signing Error: ';
}
$this->language = $PHPMAILER_LANG;
return true;
} elseif (count($this->cc) == 0) {
$result .= $this->HeaderLine('To', 'undisclosed-recipients:;');
}
- if(count($this->cc) > 0) {
- $result .= $this->AddrAppend('Cc', $this->cc);
- }
}
$from = array();
for($index = 0; $index < count($this->CustomHeader); $index++) {
$result .= $this->HeaderLine(trim($this->CustomHeader[$index][0]), $this->EncodeHeader(trim($this->CustomHeader[$index][1])));
}
- //$result .= $this->HeaderLine('MIME-Version', '1.0');
if (!$this->sign_key_file) {
$result .= $this->HeaderLine('MIME-Version', '1.0');
$result .= $this->GetMailMIME();
fclose($fp);
$signed = tempnam("", "signed");
- if (@openssl_pkcs7_sign($file, $signed, "file://".$this->sign_key_file, array("file://".$this->sign_key_file, $this->sign_key_pass), null)) {
+ if (@openssl_pkcs7_sign($file, $signed, "file://".$this->sign_cert_file, array("file://".$this->sign_key_file, $this->sign_key_pass), null)) {
$fp = fopen($signed, "r");
- $result = fread($fp, filesize($this->sign_key_file));
+ $result = '';
+ while(!feof($fp)){
+ $result = $result . fread($fp, 1024);
+ }
fclose($fp);
} else {
$this->SetError($this->Lang("signing").openssl_error_string());
$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-Type: %s; name=\"%s\"%s", $type, $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);
}
- $mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", $disposition, $name, $this->LE.$this->LE);
+ //$mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", $disposition, $name, $this->LE.$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) {
$this->SetError($this->Lang('file_open') . $path);
return '';
}
- $magic_quotes = get_magic_quotes_runtime();
- set_magic_quotes_runtime(0);
- $file_buffer = file_get_contents($path);
- $file_buffer = $this->EncodeString($file_buffer, $encoding);
+ if (function_exists('get_magic_quotes')) {
+ function get_magic_quotes() {
+ return false;
+ }
+}
+ if (PHP_VERSION < 6) {
+ $magic_quotes = get_magic_quotes_runtime();
+ set_magic_quotes_runtime(0);
+ }
+ $file_buffer = file_get_contents($path);
+ $file_buffer = $this->EncodeString($file_buffer, $encoding);
fclose($fd);
- set_magic_quotes_runtime($magic_quotes);
-
+ if (PHP_VERSION < 6) { set_magic_quotes_runtime($magic_quotes); }
return $file_buffer;
}
} // end of for
$output .= $newline.$eol;
} // end of while
- return trim($output);
+ return $output;
}
/**
$ext = $fileParts[1];
$mimeType = $this->_mime_types($ext);
if ( strlen($basedir) > 1 && substr($basedir,-1) != '/') { $basedir .= '/'; }
- if ( strlen($directory) > 1 && substr($basedir,-1) != '/') { $directory .= '/'; }
- $this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64', $mimeType);
+ if ( strlen($directory) > 1 && substr($directory,-1) != '/') { $directory .= '/'; }
if ( $this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64',$mimeType) ) {
$message = preg_replace("/".$images[1][$i]."=\"".preg_quote($url, '/')."\"/Ui", $images[1][$i]."=\"".$cid."\"", $message);
}
$this->Body = $message;
$textMsg = trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/s','',$message)));
if ( !empty($textMsg) && empty($this->AltBody) ) {
- $this->AltBody = $textMsg;
+ $this->AltBody = html_entity_decode($textMsg);
}
if ( empty($this->AltBody) ) {
$this->AltBody = 'To view this email message, open the email in with HTML compatibility!' . "\n\n";
* @param string $key_filename Parameter File Name
* @param string $key_pass Password for private key
*/
- public function Sign($key_filename, $key_pass) {
+ public function Sign($cert_filename, $key_filename, $key_pass) {
+ $this->sign_cert_file = $cert_filename;
$this->sign_key_file = $key_filename;
$this->sign_key_pass = $key_pass;
}
-
}
-?>
+?>
\ No newline at end of file