InfoPath 2010/2013: MailTo Function for InfoPath Forms

Sometimes you just want to place a MailTo Link on an InfoPath Form. This link only open your favorite mail client application and fields like subject, body or mailto are filled out by data from the InfoPath form.

 

Just add a hyperlink button to your InfoPath form and add something similar to the pseudo syntax:

concat(“mailto: “; “MailAdress” ; “?subject=ANYWORDS &body=ANYBODY, “%0D%0A%0D%0A” , “ANYBODY NEXT LINE”)


 


That’s it. Now you are able to click on a link within InfoPath and a new mail message will be open by e.g. Outlook.

For special chars in mail body use the following ASCII Table:

Example:

& => %26
CR => %OD


The article or information provided here represents completely my own personal view & thought. It is recommended to test the content or scripts of the site in the lab, before making use in the production environment & use it completely at your own risk. The articles, scripts, suggestions or tricks published on the site are provided AS-IS with no warranties or guarantees and confers no rights.

Dennis de Vries About Dennis de Vries
Loving SharePoint, Social Media and like to work together with creative people all over the world.

6 comments on “InfoPath 2010/2013: MailTo Function for InfoPath Forms

  1. Hello

    I followed your instructions and it works just fine, but i have another question, when my manager clicks on the link it opens up the email box which is great but it also opens internet explorer with error and he needs to click on back arrow to go back. Is there any way we can avoid this?? In other words when he clicks on the form it opens email box and the form stays as it is.

    Any help would be great!!!

    Thanks in Advance

  2. Hi Rahul, please let me know how your mailto link looks like, normally it should not open an Internet Explorer.
    Which version of IE do you use?

  3. Hi

    Unfortunately, this gives bad results under Internet Explorer 8 and 9 (Windows 7). Because of the “protected mode” feature of IE, when you click on a mailto: link, first your page is replaced with the about:blank, then the mail window is open.

    I did not find any solution on the net : the only choice is between the “mailto”: standard basic HTML link usage, or the protected mode. Disabling the protected mode (go to IE options, Security tab) solves the about:blank problem, but you get an alert message on top of your pages, that you can’t get rid of.

    It’s a pity that Microsoft did not find any solution to this, even in the latest versions of IE. I really like IE10, but this sort of bug is forcing me to use other browsers.

    Here are a few links I found about the subject:
    http://social.msdn.microsoft.com/Forums/ie/en-US/94d6a162-6a4c-4630-a272-dc33060bcf61/ie8-protected-mode-windows7-turn-onoff-with-javascript?forum=iewebdevelopment
    http://stackoverflow.com/questions/1674527/mailto-causing-a-blank-page-in-ie8-when-used-with-dojo/1733253#1733253

  4. Nathan Wrann

    I am attempting to add a MailTo link on infopath and I keep receiving errors. I don’t need the subject or body filled out. Just the “to”. here’s what I’ve got:

    My formula: mailto:UserEmail

    the error:
    Expected value type: end-of-string

    Actual value: ..
    mailto:–>..<–/my:UserEmail

    Any help would be greatly appreciated.

  5. Is there any way to make the link have a target:”_self” so that it doesn’t open a new window?

Submit comment

Allowed HTML tags: <a href="http://google.com">google</a> <strong>bold</strong> <em>emphasized</em> <code>code</code> <blockquote>
quote
</blockquote>

Please fill in the captcha: * Time limit is exhausted. Please reload CAPTCHA.