You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

The attached PDF is missing when saving email message as a .eml in Finder

The attached PDF is missing when saving email message as a .eml in Finder


MacBook Pro 13″, macOS 10.14

Posted on Jan 13, 2021 2:18 AM

Reply
Question marked as Top-ranking reply

Posted on Jan 13, 2021 5:17 AM

There is a reason that Apple Mail has a Save Attachments… menu item, because that .eml file is saved as ASCII text, and text files do not have attachments. Save the attached PDF, and the saved .eml file together in the same folder if you need to keep them together.

3 replies

Jan 13, 2021 5:49 AM in response to McKinney777

My previous input would save you having to do the following. Text files can have base64 encoded content appended to them, but it is not really an attachment in that sense.


When you save that email message as a .eml, it is an ASCII text file, and the PDF that was attached is transformed into included base64 encoded text such as this vastly abbreviated example of a PDF attachment that I received, which could be thousands of lines long, and in this particular case, 69371 lines of base64 encoding:



If I open this .eml in vi/vim and lets say the base64 encoding begins on line 95, I know that encoding will run through to the last line in the .eml, so in this particular case, if I want the PDF back, I must write the entire base64 encoding content to a text file. In vi/vim, I type ':' without the single quotes to get at the editor command line, and enter the following:


95,$w b64.txt
q!

That extracts the base64 encoding of the entire PDF out to a text file and then I quit the editor without changing anything.


In the Terminal command-line, I enter the following to decode the base64 encoded text back to a viewable PDF, which I then open in Preview:


base64 -d -i b64.txt -o foo.pdf
open foo.pdf


Jan 13, 2021 6:16 AM in response to VikingOSX

The first few email messages that I decided to save as .eml just happened to contain .pdf attachments. Stumped me for a while, but the desire to use this method was too compelling. That's when I sent this post and spent the next couple of hours experimenting. I scanned through about 100 emails that I planned to save and only about 6 of them had .pdf attachments.

Those .pdf were legal docs and already have been copied, signed and mailed. I suspect any future attachments will be few and easy to save as you mention.


Anyway, I appreciate your reply and giving me a peace of mind with your confirmation.


If you have any other insight or suggestion(s) on how to save important emails outside of Mac Mail I'm open to it.


Thanks.

The attached PDF is missing when saving email message as a .eml in Finder

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.