Leopard Email Stationery

Wow,

This one drove me crazy for a while. There’s a really good tutorial on macosxhints, but I couldn’t make it work. Allegedly Apple has documentation at: http://developer.apple.com/documentation/AppleApplications/Conceptual/MailArticles/

Now having said all of that. Here is how *I* did it.

  1. Create a Contents Folder to hold your project.
  2. Create a Resources Folder inside your Contents Folder.
  3. Create a content.html file inside the Resources Folder.
  4. Layout your HTML File. You can use images (even background images) but just keep everything
    in your Resources Folder for simplicity.
  5. I used inline styles to format everything. I didn’t try to use a separate stylesheet, or
    <style> tags in my document.
  6. Create a Description.plist using the Property Editor supplied with XCode.Inside the Description.plist create the following pairs:
    Property List Class Value
    HTML File String content.html
    Display Name String My Stationery
    Folder Name String My Stationery
    Stationery ID String AFC42FAB-1760-49FF-A3F3-EB251E96254E
    Thumbnail Image String thumbnail.png
  7. After you create the basic structure, create an Images Array. then inside that array you will need one entry for each picture you reference in your content.html file.
  8. If you used background images in your HTML file, then you also need to create a Background Images Array. Just like the regular Images Array, you need one entry for every background image you used in the file.
    Here is what my working plist looked like when I was finished.

  9. With your Description.plist complete, you need to create a folder called
    English.lproj
    inside your Resources Folder.
  10. Inside the English.lproj create a File Called:
    DisplayName.strings
    . Originally I had a key/value pair in my Descriptions.plist But I couldn’t get that to work. This did work.
  11. Inside the DisplayName.strings file you need to put one line.
    "Display Name" = "My Stationery";
  12. Save it.
  13. The Last Step – Take the folder that contains the Contents / Resources and label it My Stationery.mailstationery

Installing it

Allegedly, you can double click the My Stationery.mailstationery file and Mail will offer to install it. I never got that to work. In the end, I installed the stationery package by hand. To do that, navigate to:

/Library/Application Support/Apple/Mail/Stationery/Apple/Contents/Resources/

Copy your newly created stationery into the sub folder that makes the most sense to you. For example, I put mine in: ./Stationery/Contents/Resources

Once you drop the file in there, I edited the TableOfContenst.plist to add my stationery to the array.

Some Hints

My biggest trip-ups were in the plist file. All those things are case sensitive. Pay extra close attention to the key and value capitalization.

What the Heck is a Stationery ID?

It’s a unique string for the resource.   Run uuidgen in the Terminal window to generate your own unique Stationery ID. (At least unique for your mac).

While this is not comprehensive, this is the most direct path I took to get a custom html stationery running in Mac Mail.

If you don’t have XCode

You can also create the plist with a text editor, it is simply an xml file. Here is mine as
an example:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>Background Images</key>
	<array>
		<string>background.gif</string>
	</array>
	<key>Display Name</key>
	<string>Test Advantage Coupon</string>
	<key>Folder Name</key>
	<string>TACoupon</string>
	<key>HTML File</key>
	<string>content.html</string>
	<key>Images</key>
	<array>
		<string>trucktrailer.jpg</string>
		<string>gametruck2.jpg</string>
		<string>phone800.gif</string>
	</array>
	<key>Stationery ID</key>
	<string>CFBE284A-C9D4-473B-80B9-1AFC8115C62C</string>
	<key>Thumbnail Image</key>
	<string>thumbnail.png</string>
</dict>
</plist>
Explore posts in the same categories: Development, Mac OS X

Comment: