Make Microsoft Exchange 2010 Outlook Web App The Default Mail Client For Mailto Hyperlinks, And Even Pass Some Body Text, Too.

[ 1 ] Comment

This article discusses making OWA 2010 the default mail client for mailto: hyperlinks. Also described are modifications to the OWA program files that are necessary to prevent the mailto: part of the address being displayed in the new message window. The code shown here will also accept multiple email addresses separated by a semi-colon ; (something else that normal OWA will not allow). This all means that you can now use a mailto: URL like this:;

to pre-populate the OWA new email form. You can also pass in some body text, something that many people have asked for, but can’t be dome without modificatio. Note that any spaces will need to be URL-Encoded (for example the space character is escaped to %20 ).:

First, you need to get the computer to use OWA as the mailto: client. Note that you do not need to do this if a direct http OWA URL is supplied in another manner, such as an http link to your OWA from an existing web page. You only need this part in order to respond to mailto: URLs. Use Notepad to create a file named OWAMailto.vbs, containing the code below, and then double-click it to create the required registry values. Remember to change the value of strURL to your normal OWA URL before you double-click it.

' Insert your OWA URL between the quotes below, assigning a value to strURL.
' Remember to begin the URL with https if you use SSL
' Examples: "", ""
strURL = ""
If strURL <> "" Then
  Set objWSHShell = WScript.CreateObject("WScript.Shell")
  With objWSHShell
    .RegWrite "HKLM\SOFTWARE\Clients\Mail\OWA\", _
      "Outlook Web Access", "REG_SZ"
    .RegWrite "HKLM\SOFTWARE\Clients\Mail\OWA\Protocols\mailto\", _
      "URL:MailTo Protocol", "REG_SZ"
    .RegWrite "HKLM\SOFTWARE\Clients\Mail\OWA\Protocols\mailto\URL Protocol", _
      "", "REG_SZ"
    .RegWrite "HKLM\SOFTWARE\Clients\Mail\OWA\Protocols\mailto\EditFlags", _
      &H00000002, "REG_BINARY"
    .RegWrite "HKLM\SOFTWARE\Clients\Mail\OWA\Protocols\mailto\DefaultIcon\", _
      "%ProgramFiles%\Outlook Express\msimn.exe,-2", "REG_EXPAND_SZ"
    .RegWrite "HKLM\SOFTWARE\Clients\Mail\OWA\shell\open\command\", _
      """%ProgramFiles%\Internet Explorer\iexplore.exe"" ", "REG_EXPAND_SZ"
    .RegWrite "HKLM\SOFTWARE\Clients\Mail\OWA\Protocols\mailto\shell\open\command\", _
      """%ProgramFiles%\Internet Explorer\iexplore.exe""" & _
      " " & strURL & "/?ae=Item&t=IPM.Note&a=New&to=%1", "REG_EXPAND_SZ"
    .RegWrite "HKLM\SOFTWARE\Classes\mailto\shell\open\command\", _
      """%ProgramFiles%\Internet Explorer\iexplore.exe""" & _
      " " & strURL & "/?ae=Item&a=New&t=IPM.Note&to=%1", "REG_EXPAND_SZ"
  End With
  Set objWSHShell = Nothing
  WScript.Echo "Registry entries successfully created"
  WScript.Echo "You must edit this file in Notepad" & _
  ", and assign a valid OWA URL to the variable strURL"
End If

Unfortunately, if you tried to use this new feature right now, you’d find that the New Mail page ends up being populated with an address that still has mailto: at the beginning.

To get rid of the mailto: part, you will need to edit one of your server-side OWA .aspx files. Locate the file named editmessage.aspx in the folder Program Files\Microsoft\Exchange Server\V14\ClientAccess\Owa\forms\premium.Make a copy of the file (in case something goes wrong), and then open it in Notepad. Go straight to the bottom of the file, and insert this code before the closing </html> tag.

<script language="javascript">
var p, s;
var strHref = window.location.href;
s = strHref.toUpperCase();
      (s.indexOf("?AE=ITEM") != -1)
   && (s.indexOf("&A=NEW") != -1)
   && (s.indexOf("&T=IPM.NOTE") != -1)
  var objRegEx, strSubject;
  if(s.indexOf("&TO=") != -1)
    var strMsgTo = document.all.spnR.innerText;
    if(strMsgTo.toUpperCase().substring(0, 7) == "MAILTO:")
      strMsgTo = strMsgTo.substring(7);
      p = strMsgTo.toUpperCase().indexOf("?SUBJECT=");
      if(p != -1)
        strSubject = strMsgTo.substring(p + 9);
        document.all.txtSubj.value = strSubject;
        strMsgTo = strMsgTo.substring(0, p);
    document.all.divTo.innerText = "";
    var arrMsgTo = strMsgTo.split(";");
    for(i = 0; i < arrMsgTo.length; i++)
      if(i != 0)
        document.all.divTo.innerText = document.all.divTo.innerText + ";";
      document.all.divTo.innerText = document.all.divTo.innerText + arrMsgTo[i];
  else if(s.indexOf("&SUBJECT=") != -1)
    objRegEx = new RegExp("[\\?&]subject=([^&]*)");
    strSubject = objRegEx.exec(strHref);
    if(strSubject != null)
      document.all.txtSubj.value = unescape(strSubject[1]);
  if(s.indexOf("&BODY=") != -1)
    objRegEx = new RegExp("[\\?&]body=([^&]*)");
    var strBody = objRegEx.exec(strHref);
    if(strBody != null)
      var txtBdy = document.getElementById("txtBdy");
      txtBdy.innerHTML = unescape(strBody[1]);

Now the mailto: part of the email address should disappear soon after the form is displayed.

As with most of these type of modifications, you will need to check that they still function after each product update. Sometimes your modified file will be replaced by a new one from the update.

One Response to Make Microsoft Exchange 2010 Outlook Web App The Default Mail Client For Mailto Hyperlinks, And Even Pass Some Body Text, Too.

  1. Jason Jackson says:

    Replace “to=%1″ with “email=%1″ and it will leave out the mailto:. No need to modify your Exchange server.

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>