ashleymedway / mailjet.net Goto Github PK
View Code? Open in Web Editor NEW.NET Client for MailJet
License: MIT License
.NET Client for MailJet
License: MIT License
When I create a new contact or update an existing one, custom parameters (already defined in Mailjet) seem to be ignored.
var props = new Dictionary<string,string>();
props.Add("x", "9");
var contact = new MailJet.Client.Request.Contact { Email = email, Name = "testName", Action = CreateContactAction.addforce, Properties = props };
Response<ContactData> resp= client.CreateContactForList(listId, contact);
Why attacjement are only sent using SMTP and not with API ..?
With the same message,
using SMTP
System.Net.Mail.SmtpClient serv = new System.Net.Mail.SmtpClient("in-v3.mailjet.com"); serv.Credentials = new System.Net.NetworkCredential("xxx", "xxx"); serv.Send(mess);
The message has attachements
And using API
MailJet.Client.MailJetClient client = new MailJet.Client.MailJetClient("xxx", "xxx"); client.SendMessage(mess)
The email has no attachements ..?
Hi,
I think this means the compaignID property needs changing to a long within the mailjet.net codebase?
An unhandled exception of type 'Newtonsoft.Json.JsonReaderException' occurred in Newtonsoft.Json.dll
Additional information: JSON integer 4665092905 is too large or small for an Int32. Path 'Data[0].CampaignID', line 1, position 133.
Are you planning to support sending by template with vars, etc?
http://dev.mailjet.com/guides/?shell#transactional-templating
My perception might be skewed because of previous Mandrill experience, but I thought the whole value of MailJet was the ability to send Templated transactional emails. This way the HTML is structured by MailJet and compatible with most clients. I didn't see a way to do this in this library. Did I miss something obvious?
Just letting you know, HttpBasicAuthenticator has been moved around to a different namespace, so MailJet.NET fails when using RestSharp 105.2.3.0
Exception thrown: 'System.TypeLoadException' in MailJetClient.dll ("Could not load type 'RestSharp.HttpBasicAuthenticator' from assembly 'RestSharp, Version=105.2.3.0, Culture=neutral, PublicKeyToken=null'.")
PS - good job on this project, saved me a bunch of time :)
MailJetClient.SendMessage(MailMessage) method fails with "Object reference not set to an instance of an object" if MailMessage.body is empty.
Hello,
It seem to be impossible to use statistic api without method about campaign management. Particularly method on campaignaggregate (https://dev.mailjet.com/email-api/v3/campaignaggregate/).
From my actual perspective, you have to create a campaignaggregate, include some campaign inside and request statistics with CampaignAggregateID (https://dev.mailjet.com/email-api/v3/aggregategraphstatistics/). When I use method GetAggregateGraphStatistics who call method aggregategraphstatistics without any parameter, I have no result. When I pass CampaingID, I have no result neither.
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("[email protected]", "[email protected]", "subject", "email body"));
For some reason, it makes 2 requests on mailjet and I receive the email twice in my inbox:
What am I missing? Did anyone have such problems?
Thanks!
Hello
Mailjet provides ContactID / MessageID while adding contacts/sending mails.
When I invoke CreateContactForList / SendTemplateMessage [MailJetCLient.cs] the Response object does not contain the ContactID / MessageID.
var data = JsonConvert.DeserializeObject<Response>(result.Content);
Thanks
when it is acting version of dot net core? :)
When network issues occur, e.g. no network connection, the low level error code is not returned.
This could be the solution:
private SentMessageData SendMessage(RestRequest request)
{
request.RequestFormat = DataFormat.Json;
request.JsonSerializer = NewtonsoftJsonSerializer.Default;
var result = WebClient.Execute(request);
if (result.ResponseStatus == ResponseStatus.Completed && (result.StatusCode == HttpStatusCode.NoContent))
return null;
if (result.ResponseStatus == ResponseStatus.Completed && result.StatusCode == HttpStatusCode.Unauthorized)
throw new UnauthorizedAccessException("MailJet returned an HTTP 401 exception, please check your credentials");
if (result.ResponseStatus == ResponseStatus.Completed && result.StatusCode >= HttpStatusCode.BadRequest)
throw new HttpException((int)result.StatusCode, result.StatusCode.ToString());
if (result.ErrorMessage != null && String.IsNullOrWhiteSpace(result.Content))
{
throw new Exception(result.ErrorMessage);
}
else
{
var error = JsonConvert.DeserializeObject<ErrorResponse>(result.Content);
if (!String.IsNullOrWhiteSpace(error.ErrorInfo) || !String.IsNullOrWhiteSpace(error.ErrorMessage))
throw new Exception(String.Format("{0}\n{1}", error.ErrorMessage, error.ErrorMessage));
}
var data = JsonConvert.DeserializeObject<SentMessageData>(result.Content);
return data;
}
Hey, we would like to use the library in a commercial application and are now looking into the licensing aspect of it. Actually you make the source code available for free on GitHub, but you didn't specify under which license the code can be used? Is it Apache License, MIT, GPL, ... ?
Could you pls. clarify this.
Thx.
Hello,
First, Thanks for your work !
Have you plan to integrate statistics api ?
http://dev.mailjet.com/email-api/v3/aggregategraphstatistics/
Thanks
If you run client.GetContactData(), you get back an empty object, email and other properties are null, CreatedAt date is minvalue (sure shouldn't be). I tried this with a known-good contact, correct ID, has email and other properties populated in MailJet.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.