0
0
mirror of https://github.com/PHPMailer/PHPMailer.git synced 2024-09-20 10:02:14 +02:00

Merge branch 'master' into mimesign

This commit is contained in:
Synchro 2015-03-06 18:45:41 +01:00
commit 16aba043ba

View File

@ -1834,7 +1834,6 @@ class PHPMailer
return $this->MIMEHeader . $this->mailHeader . self::CRLF . $this->MIMEBody;
}
/**
* Assemble the message body.
* Returns an empty string on failure.
@ -1973,16 +1972,27 @@ class PHPMailer
throw new phpmailerException($this->lang('signing') . ' Could not write temp file');
}
$signed = tempnam(sys_get_temp_dir(), 'signed');
if (@openssl_pkcs7_sign(
$file,
$signed,
'file://' . realpath($this->sign_cert_file),
array('file://' . realpath($this->sign_key_file), $this->sign_key_pass),
null,
PKCS7_DETACHED,
$this->sign_extracerts_file
)
) {
//Workaround for PHP bug https://bugs.php.net/bug.php?id=69197
if (empty($this->sign_extracerts_file)) {
$sign = @openssl_pkcs7_sign(
$file,
$signed,
'file://' . realpath($this->sign_cert_file),
array('file://' . realpath($this->sign_key_file), $this->sign_key_pass),
null
);
} else {
$sign = @openssl_pkcs7_sign(
$file,
$signed,
'file://' . realpath($this->sign_cert_file),
array('file://' . realpath($this->sign_key_file), $this->sign_key_pass),
null,
PKCS7_DETACHED,
$this->sign_extracerts_file
);
}
if ($sign) {
@unlink($file);
$body = file_get_contents($signed);
@unlink($signed);