Today, Avi and I were discussing one of the requirements of an application he’s working on; it seemed simple enough at first blush…
He needed to send an email from a Windows 7 computer — which is fairly straightforward if you happen to have something like BLAT installed, or if you’re able to script a call to a nearby SMTP gateway. However, there was one major requirement this time: it had to appear to come from the *user* of the application, with the user’s intent/blessing/permission.
Yes, Avi could have configured the application to make a direct call to the local email client executable — if there were guaranteed to be one (not necessarily the case), and if the version/type were to be predictable (it might be Outlook, it might be GroupWise, etc.) to properly call with the correct options and flags. Avi did some digging and soon found a way to get a fully formatted message to launch in Outlook, but we had to modify it a tad to get it to work in both GroupWise and Outlook (and perhaps others). Here’s what we settled on, and how it works…
Aside: I’ll have to assume that your GroupWise or Outlook is properly installed and configured for these things to work.
start with the basics (pun intended); this should launch your email client and pre-populate the recipient (interestingly, it should work no matter whether your email client is configured or not):
…but you knew that, and you’re clearly not impressed. Now perhaps the trickiest part: after the recipient in the command — and before the next component (I use Subject in this example) — it is best to use a question (
?) mark here for Outlook *and* GroupWise compatibility, although a caret+ampersand (
^&) will work if using Outlook only (note that the “
%20” is a space character):
…and now you’re intrigued. Let’s build on that. Next, we tack on another option in the command (I show the CC option here), separated with a caret+ampersand (
…and now I’ve won you over. Cool! Let’s complete the line — separated by more caret+ampersand (
^&) characters, of course — and make it a fully populated email, ready-to-send:
Now click send, and enjoy!