-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Signature SMIME not valid #1913
Comments
Please use the debug option and provide debug output. |
Hi I had the same problem. After hours of investigation, the root cause was Have no clue why but after adding Aby idea why the mail servers change encoding (inside S/MIME part)? Or it is just my Zimbra mail server :/ Chris |
The encoding is changed because it's an RFC recommendation (if not a requirement) - if a part does not need the enhanced semantics and processing that are implied by I can see that if this downgrade occurs after the message has been signed, then that could break the signature. As you say, setting it to |
In my case, PHPMailer is used by backend to email notifications like password reset, confirmation etc. Message body is in HTML, parsed on-fly by mustache, I need UTF-8 (as user names are encoded in UTF-8) as well. My current setup include:
and finally, no issues occur. Consider updating an example so it will work out of the box for any user. Chris |
Are you sure? In my case HTML input body to openssl_pkcs7_sign() is 8bit encoded and output is 8but as well. The mail server performs downgrade that brokes S/MIME. |
PHPMailer does it here and here, which only happens while sending. Those downgrades do not involve changing the content at all - it's possible to use 8-bit UTF-8 chars in 7-bit environments but you would have to apply other encodings like quoted-printable or base64 to et the content survive intact. I guess the server might have identified other circumstances where it can apply similar downgrades? |
Well, I have spent more time investigating... You are right, there is an automatic encoding downgrade. The issue is somewhere else, inside The fix is simple - calling of the I hope it helps. Chris |
Thanks for looking into it! The If you're using |
When I send email with digital signature (SMIME), the signature considered to be not valid
Please check these things before submitting your issue:
SMTPDebug = 2
setphpmailer
, but search first!Problem description
Code to reproduce
`<?php
require DIR . "/vendor/autoload.php";
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
$mail = new PHPMailer(true);
try {
//Server settings
$mail->SMTPDebug = SMTP::DEBUG_SERVER; // Enable verbose debug output
$mail->isSMTP(); // Send using SMTP
$mail->Host = "somehost"; // Set the SMTP server to send through
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = "somemail@somehost"; // SMTP username
$mail->Password = "password"; // SMTP password
$mail->SMTPSecure = "tls"; // Enable TLS encryption;
PHPMailer::ENCRYPTION_SMTPS
also accepted$mail->Port = 587; // TCP port to connect to
} catch (Exception $e) {
echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
}
?>`
Debug output
The text was updated successfully, but these errors were encountered: