Forum Discussion

djcris's avatar
djcris
Copper Contributor
Apr 28, 2023

[Teams] Adaptive card opens outlook email template

Hello!   I'm currently developing a command bot that would display some information after the user types a command. I've successfully deployed my bot to azure environment via the teams-toolkit 5.0 ...
  • Faisal1775's avatar
    Apr 29, 2023

    djcris 

    Yes, you can create an adaptive card that, when clicked, opens an Outlook email template. Here's how you can do it:

    1. Create an adaptive card that includes a button element. Here's an example JSON code for an adaptive card with a button element:
    { "type": "AdaptiveCard",
    "body": [
    { "type": "TextBlock",
    "text": "Click the button to open an email template." }
    ],
    "actions": [
    { "type": "Action.OpenUrl",
    "title": "Open Email Template",
    "url": "mailto:email address removed for privacy reasons?subject=Example%20Subject&body=Example%20Body"
        }
      ]
    }
    1. In the actions array, specify the type of action as Action.OpenUrl. This action allows you to specify a URL to open when the button is clicked.
    2. In the url field, specify the mailto: protocol followed by the email recipient's email address, subject, and body. You can use URL encoding to encode spaces and special characters in the subject and body.

    When the user clicks the button in the adaptive card, it will open a new email message in Outlook with the specified recipient, subject, and body.

Resources