AshleyMedway / MailJet.NET

.NET Client for MailJet
MIT License
8 stars 11 forks source link

Message sent twice #8

Closed patuzov closed 8 years ago

patuzov commented 8 years ago

Hi! First of all, thanks for the library!

I am trying to send a message using the sample code:

MailJetClient client = new MailJetClient("{PublicKey}", "{PrivateKey}");
client.SendMessage(new System.Net.Mail.MailMessage("from@email.com", "to@email.com", "subject", "email body"));

For some reason, it makes 2 requests on mailjet and I receive the email twice in my inbox:

screen shot 2016-04-19 at 18 37 12

What am I missing? Did anyone have such problems?

Thanks!

patuzov commented 8 years ago

Take a look at the end of the SendMessage method:

var response = WebClient.Execute(request);
if (response.StatusCode != HttpStatusCode.OK)
    throw response.ErrorException ?? new Exception(response.StatusDescription);
return ExecuteRequest<DataItem>(request);

The request is being sent twice indeed.

AshleyMedway commented 8 years ago

Thanks, I'll check this now 👍

AshleyMedway commented 8 years ago

fixed - I will push a new release to NuGet now