Making EML files under Catalina+ Quick Lookable again

I guess I’m not the only one who saw a bug of native mail quicklook generator. If you work under Catalina or higher you may notice that when you try to quicklook the EML file in Devonthink or other app, which uses Apple mail quicklook generator, you see no more but the message header…

Here is a short script which eliminates this problem (actually adds a unix linefeeds using dos2unix command line utility; you may install it manually or just use brew install dos2unix):

-- Script to make EML files quick lookable
-- Created by Silverstone on 29.01.2021

use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions

tell application id "DNtp"
	set theRecords to (get selection)
	set n to (count of theRecords)
	set theCounter to 1
	show progress indicator "Converting EMLs…" steps n with cancel button
	repeat with theRecord in theRecords
		step progress indicator "(" & theCounter & " of " & n & "): " & (name of theRecord)
		set thePath to path of theRecord
		do shell script "/usr/local/Cellar/dos2unix/7.4.2/bin/dos2unix " & quoted form of thePath
		set theCounter to theCounter + 1
		if cancelled progress then exit repeat
	end repeat
	hide progress indicator
end tell

Check the path to dos2unix utility if you installed it to other location.

2 Likes

Nice!

Just converted 14,504 archived emails using this as a smart rule.

Cheers! )