Adding an HTML signature to Apple Mail (and have it show up properly!)

- Posted in emails html

Dropping some esoteric knowledge here.

First of all, when you have an HTML e-mail signature, you want it to have inline styles. We won’t be covering that in this blog post.

When you have your source with proper inline styles, the next challenge is to add it to a mail client.

With Outlook 365 it is as easy as copy/pasting from a web page (by selecting the text) and it will just work®.

If you try to do that for Apple Mail you will see that the Signatures part of the preference panel is intent on breaking your beautiful signature.

So in order to fix this, do the following.

  • Add a new signature with no text or just one line of text (as a reference).
  • Navigate to ~/Library/Mobile Documents/com~apple~mail/Data/V4/Signatures
  • then do ls -lt and check which is the latest signature (the date will show up in the output).
    • The filename will look something like this: `240D00D1-048D-4F86-BF8B-6050AD0F5D97.mailsignature.
  • Now quit Apple Mail.
  • Now unlock the file
    • sudo chflags nouchg 240D00D1-048D-4F86-BF8B-6050AD0F5D97.mailsignature
  • Open it in a text editor.
  • Edit the HTML. Leave the first lines of text in there (the metadata)
  • The metadata looks like this:
Content-Transfer-Encoding: 7bit
Content-Type: text/html;
	charset=us-ascii
Message-Id: <12EF408B-34C4-4E68-B1AE-080F8BD43AE7>
Mime-Version: 1.0 (Mac OS X Mail 15.0 \(3693.20.0.1.32\))
  • After the break, add your own own HTML with inline styles.
  • Make sure to host your images somewhere on the web with absolute URLs
  • I think it’s good to leave your e-mail design wrapped in Apple’s <body> code:
<body dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">PASTE HERE<br><br></body><br class="Apple-interchange-newline">

Now open Apple Mail, and you will see your beautiful signature.

Sources:  https://www.christopherbolt.com/support/knowledgebase/25/Installing-HTML-email-signatures-in-Apple-Mail.html

*Note: after some testing, locking and unlocking the file does not seem to do much.

Leave a Reply

Your email address will not be published. Required fields are marked *