MacOS – increase the minimum font size of text when reading html messages in Mail.app (in Mavericks and later)

macosmail.app

I went searching for this answer myself today after upgrading from Lion to Yosemite. In earlier versions of Apple Mail, one could use an undocumented preference to set a minimum font size for reading messages:

defaults write com.apple.mail MinimumHTMLFontSize 12

I found several references lamenting that it no longer had any effect in Mavericks or Yosemite, and that it was no longer possible to affect font sizes when reading HTML messages.

Not satisfied, I dug into the mail.app bundle and found a (partial) solution myself and will post it below. If anyone has a better solution though, I'm all ears!

Best Answer

This is not exactly the same as the minimum font size setting that was previously available, but it can rectify the issue in most irritating cases. (Namely, email from outlook users)

Mail.app has a CSS resource file that it loads in the Webkit view used to render messages. You can find it in the Mail.app bundle here:

/Applications/Mail.app/Contents/Resources/Message.css

You can add a simple CSS rule to improve your reading experience. (You could go crazy affecting styles in here too if you were so inclined...)

The biggest offender for tiny message text I've seen comes from using the size attribute on font tags. Adding this rule resolves that issue without being too opinionated about font sizes otherwise:

font[size="1"],
font[size="2"], 
font[size="3"],
[style*="font-size:5px"],
[style*="font-size: 5px"],
[style*="font-size:6px"],
[style*="font-size: 6px"],
[style*="font-size:7px"],
[style*="font-size: 7px"],
[style*="font-size:8px"],
[style*="font-size: 8px"],
[style*="font-size:9px"],
[style*="font-size: 9px"],
[style*="font-size:10px"],
[style*="font-size: 10px"],
[style*="font-size:11px"],
[style*="font-size: 11px"],
[style*="font-size:small"],
[style*="font-size: small"],
[style*="font-size:x-small"],
[style*="font-size: x-small"],
[style*="font-size:xx-small"],
[style*="font-size: xx-small"] {
    font-size: inherit !important;
}

You need root privileges to edit this file. Open it in TextWrangler/BBEdit or another text editor that allows you to save with an admin password, or edit in the shell with sudo:

sudo echo -e "\nfont[size="1"],\nfont[size="2"],\nfont[size="3"] {\n font-size: inherit !important;\n}" >> /Applications/Mail.app/Contents/Resources/Message.css

If I come across further patterns to target, I'll update this answer to include them.

EDIT: I added attribute selectors to target font-size declarations, per @danw's suggestion. I expended his selectors to cover spaces in the style attribute's string, and to cover explicit pixel sizes below 12px.