I am using the following C# code following the "Send a mail" example here to send an email with MailJet using a template. The template has a variable {{var:name}}
which is the name of the recipient.
int templateID = 610379;
MailjetRequest request = new MailjetRequest
{
Resource = Send.Resource,
}
.Property(Send.FromEmail, ConfigurationManager.AppSettings["MailJetFromEmail"].ToString())
.Property(Send.FromName, "Support Team")
.Property(Send.MjTemplateID, templateID)
.Property(Send.MjTemplateLanguage, true)
.Property(Send.Vars, new JArray
{
new JObject
{
{ "name", "Name of the customer"}
}
})
.Property(Send.Recipients, new JArray
{
new JObject
{
{ "Email", "testemailtosend@gmail.com" }
}
});
MailjetResponse response = await client.PostAsync(request);
if (response.IsSuccessStatusCode)
{
// Log success
}
else
{
// Log error
}
While response.IsStatusSuccessCode
does equal true
, my email is consistently getting blocked. Can someone please explain why the email is getting blocked and how to fix it?