Tag Archives: base64

BASE64 email raw attachment – Decode on MacOS

Take the attachment file which is Base64 encoded. The section should look like below. There is an opening string “–00000000000039139405d8b03aff” and closing with the same string “–00000000000039139405d8b03aff”. Your code will be different but beginning and ending will be always the same.

–00000000000039139405d8b03aff
Content-Type: application/msword;
name=”File22.doc”
Content-Disposition: attachment;
filename=”File22.doc”
Content-Transfer-Encoding: base64
Content-ID: <17f26f7ffc9d845639d2>
X-Attachment-Id: 17f26f7ffc9d845639d2

0M8R4KGxGuEAAAAAAAAAAAAAAAAAAAAAPgADAP7/CQAGAAAAAAAAAAAAAAABAAAAXgAAAAAAAAAA
pcEAa+ACBAAA8BK/AAAAAAAAEAAAAAAACAAA2jEAAA4AYmpialvdW90AAAAAAAAAAAAAAAAAAAAA

…………
…………
AAAAAAAAAAAAAAAAAA==

–00000000000039139405d8b03aff

Get the encoded text which starts on a new line and ends on the line before the last string “-00xxxxxx” (Bolded text below).

Method 1 – Save to text file and decode it

Save it as text file (base64.txt) in a directory.

Open it in Terminal , go to this directory and execute the command replacing the filename properly:

base64 --decode base64.txt > File22.doc

Method 2 – all in one command

base64 --decode > File22.doc
Paste_from_clipboard_the_encoded_text_here_VGhpcyBpcyBiYXNlNjQgZW5jb2RlZAo=

and press [ctrl+d] to send the pasted text.

Method 3 – use site for files up to 2MB

https://www.freeformatter.com/base64-encoder.html