1
votes

I've taken a look at the documentation for adaptive cards and actionable messages. I want to send an adaptive card via email and view it in outlook.

https://docs.microsoft.com/en-us/outlook/actionable-messages/actionable-messages-via-email

I am able to use the card playground (https://messagecardplayground.azurewebsites.net/) to send an email to myself with an adaptive card (using the button in the top right), and it renders correctly.

Everything I read about these adaptive cards makes it sound like you can just send the html markup via email (see first link). However, when I try sending the example html from that page (either with all the html tags, or just with the script tag), an adaptive card is not created, and the adaptive card debugger add-in doesn't notice anything either.

How can I send an adaptive card via email myself?

1

1 Answers

1
votes

Still not sure if I would be able to do this through an Outlook client (or any other mail client), but I was able to do it using a simple C# program that sends an email through Outlook's SMTP server.

MailMessage mail = new MailMessage("[email protected]", "[email protected]");
SmtpClient client = new SmtpClient();
string Body = System.IO.File.ReadAllText(@"C:\fullpathhere\test.html");
client.Port = 587;
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.Host = "smtp-mail.outlook.com";
client.EnableSsl = true;
client.Timeout = 10000;
client.UseDefaultCredentials = false;
client.Credentials = new System.Net.NetworkCredential("[email protected]", "password");
mail.IsBodyHtml = true;
mail.Subject = "Actionable Message Test Email";
mail.Body = Body;
client.Send(mail);

The test.html file is just the full HTML from the bottom of https://docs.microsoft.com/en-us/outlook/actionable-messages/message-card-reference.

Keep in mind most Outlook clients can't render adaptive cards and can only use actionable messages. Outlook 365's online client can render them though.