ML with circles

Mearns Learns

Mailto and Teams links

To allow users to easily ask questions or raise queries, Mailto links can be used. Mailto links can be inserted into Excel files and Power BI reports.
Clicking on the link will generate a draft e-mail. It can be edited by the user before sending.

Alternately, a link can be inserted that creates a new Microsoft Teams chat message.

Mailto and Teams links Mailto and Teams links

The advantage with these approaches is that they are low friction. Making it easy for users to engage with you.
By structuring the default text, you can immediately identify which solution the user wants to discuss.

The e-mail or message is created as draft. The user can edit it before sending or just delete it.

Ideally a generic e-mail address should be used.

The assumption in this article, is that the person using the link is running Windows and using Outlook.
There is a gotcha. By default, the built in handler will use the Windows Mail client rather than Outlook to open the link.

Generally, this option should be used on internal documents or sites, to avoid the e-mail addresses being scraped and used for spam.

Mailto Structure

The Mailto link has five fields available.
The first is mandatory and the others are optional.

Mailto: - one or more e-mail addresses, separated by semi-colons,
cc= - copy, one or more e-mail addresses, separated by semi-colons,
bcc= - blind copy, one or more e-mail addresses, separated by semi-colons,
subject= - the e-mail subject,
body= - the e-mail text.

The first parameter field is joined by a question mark (?).
The other fields are joined by an ampersand (&).

This article is focussed on a solution, where we expect Outlook to the used, so the semi-colon is used as a separator between e-mail addresses.
If we were not targeting Outlook, a comma should be used.

ASCII Hex codes

ASCII Hex codes can be used when creating default text for the body.
They can add tabs, carriage returns and new lines.
They are usually translated, but it is dependant on the mail client.
These work with Microsoft Outlook.

  • For a space use %20
  • For a tab use %09
  • For a carriage return use %0d
  • For a new line use %0a

Example HTML

To generate an e-mail like this:

Mailto and Teams links Mailto and Teams links

The following HTML would be used.

<a href="mailto:username@userdomain.com?cc=username1@userdomain.com;username2@userdomain.com;&bcc=username3@userdomain.com;&subject=Update to Power BI report&body=Hello,%0aCan the report be updated to include...%0aRegards" target="_blank">Create an Email</a>

The attribute **target="_blank" ** opens a new tab, if the link is handled by webmail

Teams chat

A link can be created that will open a Microsoft Teams chat. A text chat, a call or video call can be initiated.

On the text chat, a default message can be set.
A title can be added, but is only displayed if there are at least two other recipients.

The simplest that works on Windows, uses the MSTeams: protocol, to open the application.
A prompt is displayed to the user, to confirm opening the link in the Teams application.

Mailto and Teams links Mailto and Teams links

<a href="MSTeams:/l/chat/0/0?users=username@userdomain.com">Chat on Teams</a>

A universal approach is to use a teams.microsoft.com/1/chat/0/0? link instead.

<a href="https://teams.microsoft.com/l/chat/0/0?users=username@userdomain.com" target="_blank">Chat on Teams</a>

This will open a browser windows and prompt the user to launch Teams.
A flag can be set to automatically open Teams, however a browser window will still be opened.

Mailto and Teams links Mailto and Teams links

URL structure

The full structure of the URL for chat has three parameters.
The first is mandatory and the other two optional.

The query parameters are:

users= - A comma-separated list of one or more user e-mails that you want to chat with.
topicName= - A name for the chat, that is only displayed if you are chatting with at least two other users.
message= - The message text that you want to prepopulate into the chat.

The first parameter is preceded by a question mark (?).
The parameter fields are joined by an ampersand (&).

Example URL

To generate a chat like this:

Mailto and Teams links Mailto and Teams links

The following HTML would be used.

<a href="https://teams.microsoft.com/l/chat/0/0?users=username1@userdomain.com,username2@userdomain.com,username3@userdomain.com&topicName=Power BI Report&message=👋 Hi, I have a question about the Power BI report..." target="_blank">Start a chat</a>

Call and Video Call

To initiate a call instead of a chat, change the chat portion of the url to call.
When Teams is opened, the user will be prompted to confirm initiating the call.

Mailto and Teams links Mailto and Teams links

<a href="https://teams.microsoft.com/l/call/0/0?users=username1@userdomain.com" target="_blank">Audio call on Teams</a>

To initiate a video call, change the chat portion of the URL to call.
Add a suffix of &withVideo=true to the URL.
When Teams is opened, the user will be prompted to confirm initiating the call.

Mailto and Teams links Mailto and Teams links

<a href="https://teams.microsoft.com/l/call/0/0?users=username1@userdomain.com&withVideo=true" target="_blank">Audio and Video call WORKS</a>