installing html email signatures for multiple users

So your company has created a standard HTML email signature for Mail and needs an easy way to get that signature installed for all employees, personalized with the employee’s information?

Hmmm… You could email everyone the signature file, with instructions on how to edit it properly, and point employees to one of the online tutorials (I’ve listed a few at the end of this post) detailing the process of creating an HTML email signature in Mail. You could send your IT staff to do the installations. Or you could write an AppleScript and email that to users with instructions to download and run.

I really like the third option.

Download CreateHtmlEmailSignature3.0 or copy and paste the script and edit to work with your template. The script is set up to use a dummy template; change the value of the textHtmlSignatureTemplateUrl variable to the URL of your template. The script searches your template for placeholders named PlaceholderUserName, PlaceholderUserJobTitle, and PlaceholderUserEmailAddress, replacing that text with information that the employee inputs. The script works for Lion (10.7) and Mountain Lion (10.8). (Snow Leopard uses a different method to create HTML email signatures, and I don’t have a Snow Leopard computer to test.)

The user needs the following for the script to run:

  • The HTML email signature template has to be available on the internet. (You’ll want to do this anyway, for a number of reasons, including making updates easier.)
  • The computer running the script needs an active internet conection (to access the online signature template).
  • GUI scripting must be allowed. The script will attempt to enable GUI scripting, but users may need an administrator password to do so.

With a little editing, you can change the location of your email signature template. For example, you may prefer to use a location within your internal network instead of online.

Some tutorials for making HTML email signatures in Lion and Mountain Lion are:

Update: That first comment below is from John Connolly, a Apple Certified Mac Geek, Red Hat Certified Technician and a Microsoft Certified Professional who provides IT consultant services from his home in Canberra. I was prowling Twitter for something to do, and he had just the thing. Thanks to his help with testing and debugging, there’s an updated version of the script which works for iCloud users.

Update: The project is now on GitHub. Find it at CreateHtmlEmailSignature

17. June 2013 by sojourner hardeman
Categories: geekery | Tags: | 9 comments

Comments (9)

  1. OK. So, there’s a hiccup with the script IF you have iCloud Documents & Data syncing enabled…see here – http://matt.coneybeare.me/how-to-make-and-html-signature-in-apple-mail/ and the reference to the commenter in Step 8. Note: the whole tutorial there has been updated to adjust for iCloud syncing… As you know I’d been having problems getting it to run on my machine(s). Switching off Documents and Data syncing in the iCloud prefs allowed it to work…but then I do need the Documents and Data syncing…

  2. Hi There,

    I really loved your script. It worked great on OSX 10.7 and 10.8. But now I updated to 10.9. and it stopped working. I ajusted the check for 10.9 but I get this error:
    error “System Events got an error: Can’t set UI elements enabled of application to true.

    I’m not enough developer to fix this myself. Are you planning an update on the script? Any help is welcome.

    Thx

    Jacob

  3. Yep. I get the same problem. I’m thinking it has something to do with the accessibility features being managed differently in 10.9. Looking at the code for the script, and the error that it throws, it’s tripping over as the script attempts to enabled UI scripting at the line:

    set UI elements enabled to true

    Code snippet:


    — Handler to enable GUI scripting

    on subCheckGuiScriptingEnabled()
    tell application “System Events”
    activate — brings System Events authentication dialog to front

    if UI elements enabled is false then
    set textButtonBon to “Authenticate”
    set textButtonAnnulez to “Cancel”

    display dialog “The script requires GUI scripting to be enabled.” & return & “Please authenticate, or cancel script and contact your system administrator.” buttons {textButtonAnnulez, textButtonBon} default button textButtonBon cancel button textButtonAnnulez with title “Enable GUI Scripting”

    set UI elements enabled to true
    return UI elements enabled
    end if
    end tell
    end subCheckGuiScriptingEnabled

    =================

    Error from AppleScript editor output window:

    tell application “System Events”
    activate
    get UI elements enabled
    –> false
    display dialog “The script requires GUI scripting to be enabled.
    Please authenticate, or cancel script and contact your system administrator.” buttons {“Cancel”, “Authenticate”} default button “Authenticate” cancel button “Cancel” with title “Enable GUI Scripting”
    –> error number -1708
    «event ascrgdut»
    –> error number -1708
    display dialog “The script requires GUI scripting to be enabled.
    Please authenticate, or cancel script and contact your system administrator.” buttons {“Cancel”, “Authenticate”} default button “Authenticate” cancel button “Cancel” with title “Enable GUI Scripting”
    –> {button returned:”Authenticate”}
    set UI elements enabled to true
    –> error number -10003 from UI elements enabled of application to any
    Result:
    error “System Events got an error: Can’t set UI elements enabled of application to true.” number -10006 from UI elements enabled of application

    =================

    • I don’t have Mavericks, but I’ve done some searching to find an answer. Pre-Mavericks, checking the ‘Enable access for assistive devices’ option would enable GUI scripting for all applications. In Mavericks, that option has changed. You now have to specify which applications can use Accessibility options. Worse, because allowing Accessibility changes the application, Mavericks sees the authorized script application as a new application, meaning that you have to authorize Accessibility for the application each time.

      There is a workaround, which introduces a security vulnerability. I’m looking into code signing to see if that will make a difference. I’ll post an update when I get more information.

  4. Hi Sojourner,

    Any update on the Mavericks issue?

    Thx

Leave a Reply

Required fields are marked *