79543753

Date: 2025-03-29 19:04:21
Score: 2
Natty:
Report link

In case anyone else winds up here - they haven't updated their API documentation to reflect the actual package from NuGet. The correct code is as follows:

MailjetRequest req = new MailjetRequest();
var client = new MailjetClient(sendGridAPI, sendGridSecret);
TransactionalEmail email = new TransactionalEmail();
email.TextPart = "Text email goes in here";
email.HTMLPart = "<h1>Hello</h1>Your html email goes in here";
email.From = new SendContact("[email protected]", "That fellow");
List<SendContact> singleSend = new List<SendContact>();
singleSend.Add(new SendContact("[email protected]"));
email.To = singleSend;
var resp = await client.SendTransactionalEmailAsync(email);

Not sure why people think it's acceptable to have sample code that literally doesn't work in their up-to-date API documentation. But hey, I guess that's what the internet is for?

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Low reputation (1):
Posted by: Not My Name