我需要为 MimeMessage 指定特定的标头。
MimeMessage mMessage = new MimeMessage(session);
...
mMessage.setRecipients(Message.RecipientType.TO, tosAddr);
mMessage.setHeader("MIME-Version", "1.0");
mMessage.setHeader("Content-Type", "application/x-pkcs7-mime; smime-type=signed-data; name=\"smime.p7m\"");
mMessage.setHeader("Content-Transfer-Encoding", "base64");
mMessage.setHeader("Content-Disposition", "attachment; filename=\"smime.p7m\"");
mMessage.setText(new String(base64Data));
mMessage.saveChanges();
但是,此 mimemessage 是使用此标头创建的:
Content-Type: text/plain; charset=us-ascii; name=smime.p7m
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename="smime.p7m"
你知道为什么它会改变它的标题吗?