I can send email using C# and System.Net.Mail.SmtpClient and use Gmail as my smtp server. Now I want to add schema markups to my emails. And I expect to see them affect how an email is shown in Google products.
I've followed instructions here to do that, but got no success.
I'm using application/ld+json to embed markups.
Here is how I generate the email:
public static Task Main()
{
var mail = new MailMessage("mygmail@gmail.com", "mygmail@gmail.com");
var client = new SmtpClient("smtp.gmail.com", 587);
client.EnableSsl = true;
client.Credentials = new System.Net.NetworkCredential("mygmail@gmail.com", "my password");
mail.Subject = "fight confirmation";
mail.IsBodyHtml = true;
mail.Body = GetMailBody ();
await client.SendMailAsync (mail);
}
Here is the my GetMailBody() method:
public static string GetMailBody ()
{
return @"
<html>
<body>
<script type=""application/ld+json"">
{
""@context"": ""http://schema.org"",
""@type"": ""EmailMessage"",
""potentialAction"": {
""@type"": ""ConfirmAction"",
""name"": ""Approve Expense"",
""handler"": {
""@type"": ""HttpActionHandler"",
""url"": ""https://myexpenses.com/approve?expenseId=abc123""
}
},
""description"": ""Approval request for John's $10.13 expense for office supplies""
}
</script>
Let me know if you're in.
</body>
</html>
";
}
I expect to see a button in inbox, like the one shown in Google documentations:

But everything in my inbox is the same as it is without any schema markup.
