-
-
Notifications
You must be signed in to change notification settings - Fork 373
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
Some (PDF-)Files are not readable after sending via MimeKit #598
Comments
Try doing this: var attachment = (MImePart) bodyBuilder.Attachments.Add(path);
attachment.ContentTransferEncoding = ContentEncoding.Base64; |
Thank you very much! |
Awesome! |
I've modified the BodyBuilder logic to always use the base64 encoding for non-text attachments. The problem was that for your particular PDF, since it did not contain any nul-bytes or more than ~17% 8bit bytes, the BodyBuilder chose to encode the PDF using |
Thanks a lot! |
When I make a new release, you won't need to specify base64. It'll do it for you. |
Hello,
I observe a strange behavior when sending PDF files via MimeKit.
Most files are transmitted without problems, but few are not readable.
It seems, that Lf is converted into CrLf.
Could this be caused by MimeKit?
OS: Windows 10 2004 (19041.450) 64-Bit
.Net 4.8, WinForms
MimeKit Version: 2.9.0.0
Tested with Email-Provider: gmail.com
I attached 2 files: 'Original.pdf' before and 'Corrupt.pdf' after sending.
Screenshot 'Difference.png' shows the difference.
'Original.pdf' is readable with 'Adobe Acrobat Reader DC 2020.012.20043', 'Corrupt.pdf' not.
Attachment is added with this code:
var bodyBuilder = new BodyBuilder();
bodyBuilder.HtmlBody = htmlBody;
bodyBuilder.Attachments.Add(path);
mimeMessage.Body = bodyBuilder.ToMessageBody();
Thank you very much for your help!
Michael.
Original.pdf
Corrupt.pdf
The text was updated successfully, but these errors were encountered: