MailJet Giving Success Response But Not Sending

285 views Asked by At

I'm just using MailJet's simple send email code example. When I send a test email using a verified email address I get a success response with a message ID, but nothing is sent. When I look at the MailJet's site it says 0 sent and 0 delivered. Any idea what I'm doing wrong?

    private async void button1_Click(object sender, EventArgs e)
    {

        await RunAsync();
    }

    static async Task RunAsync()
    {
        MailjetClient client = new MailjetClient("************", "*************");
        MailjetRequest request = new MailjetRequest
        {
            Resource = Send.Resource,
        }
           .Property(Send.FromEmail, "[email protected]")
           .Property(Send.FromName, "Test Email")
           .Property(Send.Subject, "Test Email Subject")
           .Property(Send.TextPart, "This is a test email!")
           .Property(Send.HtmlPart, "This is a text email!")
           .Property(Send.Recipients, new JArray
                {
                    new JObject
                        {
                            {"Email", "[email protected]"}
                        }
               });
        MailjetResponse response = await client.PostAsync(request);
        if (response.IsSuccessStatusCode)
        {
            Console.WriteLine(string.Format("Total: {0}, Count: {1}\n", response.GetTotal(), response.GetCount()));
            Console.WriteLine(response.GetData());
        }
        else
        {
            Console.WriteLine(string.Format("StatusCode: {0}\n", response.StatusCode));
            Console.WriteLine(string.Format("ErrorInfo: {0}\n", response.GetErrorInfo()));
            Console.WriteLine(string.Format("ErrorMessage: {0}\n", response.GetErrorMessage()));
        }
    }
0

There are 0 answers