Forum Discussion
djcris
Apr 28, 2023Copper Contributor
[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 ...
- Apr 29, 2023
Yes, you can create an adaptive card that, when clicked, opens an Outlook email template. Here's how you can do it:
- 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"}]}- 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.
- 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.
Faisal1775
Brass Contributor
Yes, you can create an adaptive card that, when clicked, opens an Outlook email template. Here's how you can do it:
- 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"
}
]
}
- 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.
- 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.
djcris
Apr 29, 2023Copper Contributor
Thank you for that example!
I still for some reason have an strange instance where teams on the web would become unresponsive after I click on the "Open Email Template" button, but it won't crash on the desktop app.
Any ideas?
I still for some reason have an strange instance where teams on the web would become unresponsive after I click on the "Open Email Template" button, but it won't crash on the desktop app.
Any ideas?
- Prasad_Das-MSFTMay 18, 2023Microsoft
djcris - Is there any console error you are getting in Teams web?