I am trying to passing custom message id (X-Message-Id) from while sending email. var client = new SendGridClient(apiKey);
var msg = new SendGridMessage()
{
From = new EmailAddress("test@gmail.com", "Ravi Kumar"),
Subject = "Sending with Twilio SendGrid is Fun",
HtmlContent = "<body><a href='http://www.sendgrid.com'>SendGrid</a></body>",
};
msg.AddTo(new EmailAddress("test@gmail.com", "Ravi CIPL"));
How can i pass custom X-Message-Id to sendgrid that can be get from the webhook event.
You can add a header to an email in SendGrid C# using the msg.AddHeader
method:
var msg = new SendGridMessage()
{
From = new EmailAddress("test@gmail.com", "Ravi Kumar"),
Subject = "Sending with Twilio SendGrid is Fun",
HtmlContent = "<body><a href='http://www.sendgrid.com'>SendGrid</a></body>",
};
msg.AddTo(new EmailAddress("test@gmail.com", "Ravi CIPL"));
msg.AddHeader("X-Message-ID", myMessageId);