mailjet / mailjet-apiv3-php Goto Github PK
View Code? Open in Web Editor NEW[API v3] Mailjet PHP Wrapper
Home Page: http://dev.mailjet.com
License: MIT License
[API v3] Mailjet PHP Wrapper
Home Page: http://dev.mailjet.com
License: MIT License
I try to overide content-type of my email
$data= json_encode([
'FromEmail' => key($message->getFrom()),
'Recipients' => $recipients,
'Subject' => $message->getSubject(),
'Text-part' => $message->getBody(),
'Html-part' => $message->getBody(),
'Inline_attachments' => $pj,
'Headers' => [
'Content-type' => 'multipart/related;
] ,]);
$request = $this->client->post('/v3/send', ['Content-Type' => 'application/json'],$data);
REsult in my source email 👎
Content-type: multipart/mixed; boundary="=-cQh7nYG1al181j3dCjq6"
Hi,
I am using this lib for few hours and I can't find a way to get error details when a POST query has some error.
In my example, I am creating new contacts in a contacts list. After $mj->get(Resources::$ContactslistManagemanycontacts, ['id' => $id, 'body' => $body])
I have my JobID then get the Job with the same resource and provide the job id with 'actionid' parameter instead of body. ($mj->get(Resources::$ContactslistManagemanycontacts, ['id' => $id, 'actionid' => $jobID])
).
Then I get 'Status' state to 'Error' (in job data) with the 'ErrorFile' index but I can't find a way on how to use this data on an easy way. So I am "cheating" and use Guzzle library to be able to query the uri without constraints.
Is there a way to use this ErrorFile ? Or is it currently impossible ?
Note : I am using Symfony3.
Hi,
I want to integrate your classes to call Mailjet and get my profile data, but I get a HTTP status 400 (and getData()
is empty).
When I made a mistake in my secret key, I get a HTTP 401, which I suppose is normal.
I think I called your class by a wrong way but I did't found where is the problem.
Can you help me please?
Here is my code:
require 'vendor/autoload.php';
use \Mailjet\Resources;
$apikey = 'aaaaaaaaaaaa';
$apisecret = 'bbbbbbbbbbbbbbbbbb';
$mjobj = new \Mailjet\Client($apikey, $apisecret);
$mjrep = $mjobj->get(Resources::$Myprofile);
echo('http_status='.$mjrep->getStatus());
Thanks a lot
Best regards
Jérôme
Hi guys!
Apparently, in some distributions of PHP, the JSON_BIGINT_AS_STRING
ability is not implemented. This leads to the logs filling with:
ErrorException [ 2 ]: json_decode(): option JSON_BIGINT_AS_STRING not implemented
This comes from the Response::__construct()
method.
There was actually an issue opened about this already on the old SDK: mailjet/mailjet-apiv3-php-simple#126. So now I'm opening it on the new one :).
The php-jwt library has a work-around for this: https://github.com/firebase/php-jwt/blob/c35d52bd53fafd4a92c72c8e0b8489ebfc1a4306/src/JWT.php#L249 - perhaps that could be used... or maybe the JSON_BIGINT_AS_STRING
constant isn't needed?
Thanks!
Hello,
This function doesn't work :
function unsubscribeContact($contactID,$listID) {
$mj = new Mailjet();
$params = array(
"method" => "PUT",
"ListID" => $listID,
"ID" => $contactID,
"IsUnsubscribed" => TRUE,
);
// Traitement
}
[ErrorMessage] => Object not found
[StatusCode] => 404
Post Arguments
ListID = 2
ID = 2
IsUnsubscribed = 1
Call url https://api.mailjet.com/v3/REST/listrecipient/2
Why ? Thank you for your help.
Hello,
I am trying to use mailjet with my PHP version 5.4.27
When I call $mj->post(Resources::$Email, ['body' => $body]);
, the mail is well sent, but then the process is stopped and I got an error:
PHP Fatal error: Call to undefined function GuzzleHttp\\Handler\\curl_reset() in C:\\Apache2.2\\htdocs\\mailjet\\mailjet-apiv3-php\\vendor\\guzzlehttp\\guzzle\\src\\Handler\\CurlFactory.php on line 78
According to the doc, it seems that curl_reset is available only for php >= 5.5.0.
In your doc, requirements is set to PHP >= 5.4.
Could you please check if a fix could be provided ?
Thanks a lot.
Cheers
Hi,
I'm trying to create a contactlist over the API.
I'm always gettin a 400.
First I check if a list for a specific name already exist - That work's fine.
If a list doesn't exist, i want to create it.
That's how I try ist:
$params = ['Name' => $name]; $response = $mailjet->post(Resources::$Contactslist,$params);
EDIT: At the moment i try to create the list with name "Test-Test-Test"
{ ["ErrorInfo"]=> string(69) "MJ08 Property Name is invalid: MJ04 Value must have at least length 1" ["ErrorMessage"]=> string(25) "Object properties invalid" ["StatusCode"]=> int(400) }
Can anyone help?
I'm trying to write some test cases for the Omnimail library - https://github.com/gabrielbull/omnimail
I need to pass in some mock responses to the Client to get it to return and process them. I've done a couple of the other gateways using Guzzle MockHandler (but your implementation doesn't use Guzzle)
Any chance you could build in some sort of Mock system? I'd be willing to do it if you could give some direction on how you'd like it to happen.
Hi,
I've dowloaded the nocomposer project and I get that:
Fatal error: Call to undefined function GuzzleHttp\Handler\curl_reset() in /myfolders/libraries/MJ/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php on line 78
Here is my code:
require "/myfolders/libraries/MJ/vendor/autoload.php";
$mj = new \Mailjet\Client($this->apiKey, $this->secretKey);
$body = [
'FromEmail' => "[email protected]",
'FromName' => "Mailjet Pilot",
'Subject' => "Your email flight plan!",
'Text-part' => "Dear passenger, welcome to Mailjet! May the delivery force be with you!",
'Html-part' => "hello",
'Recipients' => [['Email' => "[email protected]"]]
];
$response = $mj->post(\Mailjet\Resources::$Email, ['body' => $body]);
Any ideas?
Thanks
Bonjour,
Je veux utiliser Mailjet\Resources::$SenderValidate qui est présent dans votre documentation.
Mais lorsque je veux accéder à cette fonction, j'ai un message me disant :
Access to undeclared static property: Mailjet\Resources::$SenderValidate.
Il semble bien que SenderValidate ne soit pas présent dans votre fichier "Ressources.php".
Pouvez-vous me dire comment utiliser cette fonction ?
Merci
Hi,
I tried this project with composer, I created a contactlist with this code
$body = [ 'Name' => 'mynewlist' ]; $response = $this->_con->post(Resources::$Contactslist, ['body' => $body]);
It worked, i can see my fresh list in mailjet, but the response is always "null", in fact, every request i do, the response is always null.
Hi,
I like mailjet, but i need to find a way to retrieve mails of all people ask for unsub in all my different contact list on my mailjet account ? Is it possible ?
Thank in advance
Maxime
Hi,
I've got a problem with subscribes and contacts lists : i unsubscribed 2 mail on a contact list. Then I sent a request to get the subscribed mail of this list. But apparently, it always returns all the list.
All "UnsubscribedAt" properties of the contacts are empty.
I checked, the mails are unsubscribed, on the mailjet site.
My request :
$filters = ['ContactsList' => "1",'IsUnsubscribed' => false];
$response = $mj->get(Resources::$Contact,['filters'=>$filters]);
If 'IsUnsubscribed' = false => Returns me the contact list 1.
If 'IsUnsubscribed' = true => Returns me empty array.
In fact, it seems not detect if a contact is unsubscribed (instead the unsubscriptions marked in the contact list, on the mailjet site).
I tested with exclusions, and it works for it. But I don't understand why it doesn't with subscriptions.
Api problem, or of mine ?
Your idea is probably to be misconfigured to have the problem of indentations
https://github.com/mailjet/mailjet-apiv3-php/blob/master/src/Mailjet/Request.php#L76-L82
Hello, Im having trouble getting new API working. For any request Im getting 400 error. My credentials are ok.
//new mailjet API call
$mj = new \Mailjet\Client($this->api_key,$this->api_secret);
$response = $mj->get(Resources::$Myprofile);
Debugger::dump($mj);
Debugger::dump($response);
die;
And getting this result:
(Mailjet\Client` #f6b5
apikey private => "xxx" (32)
apisecret private => "xxx" (32)
version private => "v3/" (3)
secure private => TRUE
call private => TRUE
Mailjet\Response #dbef
status private => 400
success private => FALSE
body private => NULL
request => Mailjet\Request #45cd
method private => "GET" (3)
url private => "https://api.mailjet.com/v3/REST/myprofile" (41)
filters private => array ()
body private => "{}" (2)
auth private => array (2)
0 => "xxx" (32)
1 => "xxx" (32)
config private => array (8)
type => "application/json" (16))
To be honest I didn't find much useful in documentation about new version of API. But really want to get it working:)
Im running it on localhost at the time. Do you thing this is the issue?
Thanks
This library does not delivery the reasonPhrase on a 400.
It is available in the guzzle via "$response->getReasonPhrase()"
Without this i have to guess whats the problem with my request: https://dev.mailjet.com/guides/?php#send-api-errors
Hello,
Je ne comprends pas du tout comment fonctionnent les statistiques avec l'API V3.
Quelqu'un peut-il me donner un exemple concret de récupération de stats via un ID NEWSLETTER. (Ouvertures, Clics, Bounces).
J'ai beau tout retourner, rien ne fonctionne pour moi.
Exemple de code :
$mj = new \Mailjet\Client(env('MAILJET_API_KEY', ''), env('MAILJET_PRIVATE_KEY', ''));
$customvalue = "mj.nl=17431";
$params = array(
"method" => "VIEW",
"unique" => $customvalue
);
$response = $mj->get(\Mailjet\Resources::$Campaignstatistics, $params);
$data = $response->getData();
Cela me retourne toutes les listes sauf celle que je veux, etc..
Merci beaucoup pour votre aide !
Emmanuel.
Hello,
How can i add cc and Bcc option in my parameters to send email with Mailjet ?
Thanks
fix that condition.
$contentType = $action ==
('csvdata/text:plain' || $action == 'csverror/text:csv') ?
'text/plain' : 'application/json';
https://github.com/mailjet/mailjet-apiv3-php/blob/master/src/Mailjet/Client.php#L71
I've found that error while trying to send a newsletter. The Client is creating a Request with content-type text/plain, APIs don't like that.
Bonjour,
Tout d'abord, ravi de voir que votre api s'enrichie rapidement.
J'ai malgré tout un problème pour charger la page "campaigns" avec un token qui ne semble plus valide depuis quelques semaines.
Code
$mj = new \Mailjet\Client($cle, $mdp);
$response = $mj->get(Resources::$Apitoken);
$token="";
if($response->success()) {
$data=$response->getData();
foreach($data as $d) {
if ($d['IsActive']) {
$token=$d['Token'];
break;
}
}
}
$url="https://www.mailjet.com/campaigns?t=".$token;
L'url génèrée est soumise à une iframe dont voici le code retour ci-dessous (cela a été aussi testé en curl avec le même résultat).
**Sorry the page you are trying to view is not here.**
Here's what we received from the server: This token is invalid..
L'url a changée ou plus possible de le faire ? impossible de trouver des infos sur votre documentation, j'ai surement loupé quelque chose.
A noter que même résultat avec l'api php-mailjet-v3-simple.class.php.
A part ca, mes autres appels de votre API fonctionnent correctement mais nous souhaitons afficher vos interfaces comme nous le faisions auparavant sans devoir re-développer tout votre "front".
Dans l'attente de votre réponse.
Bonjour,
J'intègre l'API MAiljet pour de nouveaux comptes V3 de mes clients.
En l'occurence je suis en train de changer la classe qui envoie des emails transactionnels.
J'arrive à envoyer un mail avec un fichier txt attaché comme dans l'exemple : http://dev.mailjet.com/guides/?php#sending-with-attached-files
Mais impossible d'envoyer un mail avec un fichier .PDF :
$email = [
'FromName' => 'Mon expediteur',
'FromEmail' => '[email protected]',
'Subject' => 'Hey!',
'Text-Part' => 'Hello Humans!',
'Html-Part' => '<p>Hello Humans</p>',
'Recipients' => [
['Email' => '[email protected]', 'Name' => 'destinataire1'],
['Email' => '[email protected]', 'Name' => 'destinataire2']
],
'Attachments' => [
[
'Content-type' => "application/x-pdf", // ou application/pdf ne passe pas non plus
'Filename' => "test.pdf"
]
]
];
...php
Deplus je ne trouve pas dans la documentation à quoi correspond la dernière propriété content de l'objet Attachement. Pour information voici le code erreur
...php
PHP Fatal error: Uncaught exception 'GuzzleHttp\Exception\ServerException' with message 'Server error response [url] https://api.mailjet.com/v3/send [status code] 500 [reason phrase] Invalid stream operation' in /var/www/crons/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:89
Stack trace:
#0 /var/www/crons/vendor/guzzlehttp/guzzle/src/Subscriber/HttpError.php(33): GuzzleHttp\Exception\RequestException::create(Object(GuzzleHttp\Message\Request), Object(GuzzleHttp\Message\Response))
#1 /var/www/crons/vendor/guzzlehttp/guzzle/src/Event/Emitter.php(109): GuzzleHttp\Subscriber\HttpError->onComplete(Object(GuzzleHttp\Event\CompleteEvent), 'complete')
#2 /var/www/crons/vendor/guzzlehttp/guzzle/src/RequestFsm.php(91): GuzzleHttp\Event\Emitter->emit('complete', Object(GuzzleHttp\Event\CompleteEvent))
#3 /var/www/crons/vendor/guzzlehttp/guzzle/src/RequestFsm.php(132): GuzzleHttp\RequestFsm->__invoke(Object(GuzzleHttp\Transaction))
#4 /var/www/crons/vendor/react/promise/src/FulfilledPromise.php(25): GuzzleHttp\RequestFsm->G in /var/www/crons/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php on line 89
...php
Hi,
I'm trying to update a contact data via API user the wrapper. Thought, I have an error as response.
Here is what I send to the wrapper :
$this->mj->put(\Mailjet\Resources::$Contactdata, [ 'id' => '[email protected]', 'body' => [['Name' => 'firstname', 'value' => 'John']] ]);
Here is the error I get :
array(3) {
["ErrorInfo"]=>
string(0) ""
["ErrorMessage"]=>
string(88) "Invalid json input: expected "]", but found "{" at stream position 2 ...[{|"Name":"fi..."
["StatusCode"]=>
int(400)
}
would there be a quick patch to apply there, or would I have better call the API without wrapper for that type of query please ?
The dist directory is not necessary in repository . You have an Release section for not composer package and Packagist for composer.
Having a zip which regularly changes will overload the repository for nothing, and in addition the zip is not usable in the state. We must decompress and eventually stop using the repository. :-/
PHP Fatal error: Uncaught exception 'GuzzleHttp\Exception\ServerException' with message 'Server error: POST https://api.mailjet.com/v3/send
resulted in a 502 Bad Gateway
response
Hi , I can't install the API PHP , I tested via two servers (Debian8), same result
⇒ php -v PHP 5.6.14-0+deb8u1 (cli) (built: Oct 4 2015 16:13:10)
⇒ composer --version Composer version 1.0-dev
⇒ composer require guzzlehttp/guzzle
Using version ^6.1 for guzzlehttp/guzzle
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Writing lock file
Generating autoload files
composer.json => "guzzlehttp/guzzle": "^6.1"
⇒ composer require mailjet/mailjet-apiv3-php
Using version ^1.0 for mailjet/mailjet-apiv3-php
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- mailjet/mailjet-apiv3-php v1.0.3 requires guzzlehttp/guzzle ~5.3.0 -> no matching package found.
- mailjet/mailjet-apiv3-php v1.0.2 requires guzzlehttp/guzzle ~5.3.0 -> no matching package found.
- mailjet/mailjet-apiv3-php v1.0.1 requires guzzlehttp/guzzle ^5.3 -> no matching package found.
- mailjet/mailjet-apiv3-php v1.0.0 requires guzzlehttp/guzzle ^5.3 -> no matching package found.
- Installation request for mailjet/mailjet-apiv3-php ^1.0 -> satisfiable by mailjet/mailjet-apiv3-php[v1.0.0, v1.0.1, v1.0.2, v1.0.3].
Potential causes:
Read https://getcomposer.org/doc/articles/troubleshooting.md for further common problems.
Thanks
Hello,
J'utilise l'api de mailjet pour envoyer mes mails, l'envoi se passe bien. Le hic c'est quand je souhaite récupérer le statut d'un message (envoyé, bloqué etc ...).
Le retour de l'api me donne bien un ID, mais lorsque j'appel la fonction de récupération du message par cet ID, le message est introuvable. Mais si je remplace mon ID par le 2eme (voir screen) le message est bien trouvé
Sur le screen on peut voir que les deux ID diffères, mais je ne parviens pas à récupérer le 2eme pour pouvoir afficher les informations relatives à un message.
J’espère que ma demande est assez claire
Merci, bonne journée
I am not clear that standard to the first letter of a field? https://github.com/mailjet/mailjet-apiv3-php/blob/master/src/Mailjet/Resources.php#L29-L111
Hello,
I've been trying to use the CustomID in the emails I send, so I can identify them when I parse them in the call to my webhook.
However, the Mj-CustomID doesn't seem to be saved.
Sent using
curl -s \
-X POST \
--user "$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE" \
https://api.mailjet.com/v3/send \
-H 'Content-Type: application/json' \
-d '{
"FromEmail":"[email protected]",
"FromName":"Mailjet Pilot",
"Subject":"Your email flight plan!",
"Text-part":"Dear passenger, welcome to Mailjet! May the delivery force be with you!",
"Html-part":"<h3>Dear passenger, welcome to Mailjet!</h3><br />May the delivery force be with you!",
"Recipients":[{"Email":"[email protected]"}],
"Mj-CustomID":"PassengerEticket1234"
}'
Returns
{ "Sent" : [{ "Email" : "[email protected]", "MessageID" : 18295938938421304 }] }
Then
curl -s \
-X GET \
--user "$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE" \
https://api.mailjet.com/v3/REST/messagesentstatistics?CustomID=PassengerEticket1234
Returns
{ "Count" : 0, "Data" : [], "Total" : 0 }
Am I missing anything?
Thanks!!
I would use this lib for my PHP project but I see that only the lite version has been declared in Packagist.
It's possible to add it to use Composer.
Hi,
We have updated our composer with your new repository, but it doesn't work.
Our dump from Mailjet\Response
return this : https://gist.github.com/roukmoute/35d4f2288048dae979c1
Where is the problem?
Thanks
On you php classes remove end tag php, is not necessary and it avoids some problems with carriage returns
https://github.com/mailjet/mailjet-apiv3-php/blob/master/src/Mailjet/Request.php#L140
Hi,
I run two version of the same program using the API.
With that second server, I have an issue. The response returned when i send an email gives me a MessageID as a rounded number like : 2.054774882955E16
With my local version, the MessageID is a complete number like 18014470552713635
I think I misconfigured something but I don't know where I can find a solution. Any idea to help ?
Thank you !
In Endpoint file you call a method "call" why not. But she is private and not static. I wonder if it is functional, at least if this is the case it is odd and not normal https://github.com/mailjet/mailjet-apiv3-php/blob/master/src/Mailjet/Endpoint.php#L65
Hello,
I try to figure out why i can't update or insert contact properties while subscribing to a list.
After the request, the contact is in the list, but any properties i gave are never updated. If i update one of them from the mailjet dashboard, i can see it in the response
$body = [
'Email' => $email,
'Action' => 'addforce',
'Properties' => json_encode([
"gamme_z" => "oui",
])
];
$response = $this->mj->post(
Resources::$ContactslistManagecontact, [
'id' => $listId,
'body' => $body
]
);
the response contains the ContactID, Email, Action, Name and some Properties, but not the one i gave in the request (the property exists, as i can see/update it when i edit a contact from my dashboard)
If i need to make an other request just for updating the properties, this is not a problem, but the document does not expose any endpoint for this.
Any idea ?
Thank you
Bonjour,
j'ai cette erreur et je ne trouve pas de solution :
Warning:` json_encode() expects at most 2 parameters, 3 given in vendor/guzzlehttp/guzzle/src/functions.php on line 323
Fatal error: Call to undefined function GuzzleHttp\Handler\curl_reset() in guzzlehttp/guzzle/src/Handler/CurlFactory.php on line 78
Mon code est simple
<?php require 'vendor/autoload.php';
use \Mailjet\Resources;
$apikey = 'xxx';
$apisecret = 'xxx';
$mj = new \Mailjet\Client($apikey, $apisecret);
debug($mj);
$body = [
'FromEmail' => "[email protected]",
'FromName' => "Mailjet Pilot",
'Subject' => "Your email flight plan!",
'Text-part' => "Dear passenger, welcome to Mailjet! May the delivery force be with you!",
'Html-part' => "<h3>Dear passenger, welcome to Mailjet!</h3><br />May the delivery force be with you!",
'Recipients' => [['Email' => "[email protected]"]]
];
$response = $mj->post(Resources::$Email, ['body' => $body]);
debug($response);
Hi
I'd like to create a subclass that overrides the api URL (getApiUrl function in Client.php), so I can use a server that I own to test my emails without having to have real email adresses and spam the world. :)
https://github.com/mailjet/mailjet-apiv3-php/blob/master/src/Mailjet/Client.php#L88
Is it possible ? Why is this method private in the first place ?
Thanks !
I have tried to include an emoji in the subject line and I see them being sent into the library, but on the receiving end of the email, the emoji never arrives. It's seems like it is being stripped.
These are some variations of what I tried:
$emoji = json_decode('"\uD83D\uDCB8"');
$emoji = html_entity_decode('💸');
Require in classes with composer is not necessary https://github.com/mailjet/mailjet-apiv3-php/blob/master/src/Mailjet/Client.php#L16
Hi !
The implementation of /contactdata documented here http://dev.mailjet.com/guides/personalisation-guide/ is not implemented yet ?
Also, the documentation is not good on some points, the worst is when you want to add custom fields, it was just a PITA…
The 'Name' & 'Value' fields are not documented here -> http://dev.mailjet.com/email-api/v3/contactdata/
And this is not cool in an open source repo :
@see http://mjdemo.poxx.net/~shubham/apikey.html
My code for future users, I'm using Guzzle in Symfony 2
$body = json_encode([
'Data' => [
['Name' => 'firstname', 'value' => $user->getFirstName()],
['Name' => 'lastname', 'value' => $user->getLastName()],
]
]);
$request = $client->createRequest('PUT', 'https://api.mailjet.com/v3/REST/contactdata/'.$user->getEmail(), [
'auth'=> ['api_key','api_secret'],
'body' => $body
]);
$request->setHeader('Content-Type', 'application/json');
$response = $client->send($request);
$code = $response->getStatusCode();
echo "--->".$code;
Seriously a namepsace declaration lowercase with PSR-0 capitalize ? https://github.com/mailjet/mailjet-apiv3-php/blob/master/src/Mailjet/Client.php#L14
I'm trying to send out an email with your templating system, however the 500 response I am getting is to cryptic to understand. 500 Invalid floating point operation
$smtp = $this->getConfig();
$client = new Client($smtp->username, $smtp->password);
$body = [
'FromEmail' => '[email protected]',
'FromName' => "Test",
'Mj-TemplateID' => $templateId,
'MJ-TemplateLanguage' => true,
'Subject' => $subject,
'Vars' => $vars,
'Recipients' => [
[
'Email' => $to
]
]
];
$response = $client->post(Resources::$Email, $body);
And this is the response
object(Mailjet\Response)[200]
private 'status' => int 500
private 'success' => boolean false
private 'body' => null
public 'request' =>
object(Mailjet\Request)[171]
private 'method' => string 'POST' (length=4)
private 'url' => string 'https://api.mailjet.com/v3/send' (length=31)
private 'filters' =>
array (size=0)
empty
private 'body' => string '{}' (length=2)
private 'auth' =>
array (size=2)
0 => string '285[REDACTED]' (length=32)
1 => string '791[REDACTED]' (length=32)
private 'type' => string 'application/json' (length=16)
private 'messageFactory' (GuzzleHttp\Client) =>
object(GuzzleHttp\Message\MessageFactory)[174]
private 'errorPlugin' =>
object(GuzzleHttp\Subscriber\HttpError)[175]
...
private 'redirectPlugin' =>
object(GuzzleHttp\Subscriber\Redirect)[176]
...
private 'customOptions' =>
array (size=0)
...
private 'baseUrl' (GuzzleHttp\Client) =>
object(GuzzleHttp\Url)[173]
private 'scheme' => string '' (length=0)
private 'host' => string '' (length=0)
private 'port' => null
private 'username' => null
private 'password' => null
private 'path' => string '' (length=0)
private 'fragment' => null
private 'query' => null
private 'defaults' (GuzzleHttp\Client) =>
array (size=5)
'allow_redirects' => boolean true
'exceptions' => boolean true
'decode_content' => boolean true
'verify' => boolean true
'headers' =>
array (size=1)
...
private 'fsm' (GuzzleHttp\Client) =>
object(GuzzleHttp\RequestFsm)[181]
private 'handler' =>
object(Closure)[180]
...
private 'mf' =>
object(GuzzleHttp\Message\MessageFactory)[174]
...
private 'maxTransitions' => int 200
private 'emitter' (GuzzleHttp\Client) =>
object(GuzzleHttp\Event\Emitter)[182]
private 'listeners' =>
array (size=0)
...
private 'sorted' =>
array (size=0)
...
public 'rawResponse' =>
object(GuzzleHttp\Message\Response)[222]
private 'reasonPhrase' => string 'Invalid floating point operation' (length=32)
private 'statusCode' => int 500
private 'effectiveUrl' => string 'https://api.mailjet.com/v3/send' (length=31)
private 'headers' (GuzzleHttp\Message\AbstractMessage) =>
array (size=6)
'server' =>
array (size=1)
...
'date' =>
array (size=1)
...
'content-type' =>
array (size=1)
...
'content-length' =>
array (size=1)
...
'connection' =>
array (size=1)
...
'vary' =>
array (size=1)
...
private 'headerNames' (GuzzleHttp\Message\AbstractMessage) =>
array (size=6)
'server' => string 'Server' (length=6)
'date' => string 'Date' (length=4)
'content-type' => string 'Content-Type' (length=12)
'content-length' => string 'Content-Length' (length=14)
'connection' => string 'Connection' (length=10)
'vary' => string 'Vary' (length=4)
private 'body' (GuzzleHttp\Message\AbstractMessage) =>
object(GuzzleHttp\Stream\Stream)[221]
private 'stream' => resource(286, stream)
private 'size' => null
private 'seekable' => boolean true
private 'readable' => boolean true
private 'writable' => boolean true
private 'uri' => string 'php://temp' (length=10)
private 'customMetadata' =>
array (size=0)
...
private 'protocolVersion' (GuzzleHttp\Message\AbstractMessage) => string '1.1' (length=3)
Hi!
I'm trying to send a hungarian newsletter through the API (with PHP wrapper).
When I call the /newsletter
resource, I'm getting this error, when I set the Locale
property to hu
or hu_HU
:
MJ08 Property Locale is invalid: Invalid locale: "hu_HU"
If I'm using for example en
for the Locale
property, it works.
Is this a bug, or I don't use this property well?
Thanks
Are you planning to release a proper Laravel Mail Transport implementation?
Hi,
I'm trying to find a Listrecipient by contact-mail.
Then I will unsubscribe the contact from list.
My first problem:
Im trying to find the Listrecipient this way:
$params = ['body' => ['ContactALT' => $mail, 'ListID' => $listId]]; $response = $mailjet->get(Resources::$Listrecipient,$params);
But I'm getting following (hope this is readable):
`array(7) { ["ContactID"]=> int(1) ["ID"]=> int(6) ["IsActive"]=> bool(true) ["IsUnsubscribed"]=> bool(true) ["ListID"]=> int(3) ["ListName"]=> string(13) "ThisIsATest" ["UnsubscribedAt"]=> string(20) "2015-12-08T15:10:32Z" }
array(7) { ["ContactID"]=> int(6) ["ID"]=> int(7) ["IsActive"]=> bool(true) ["IsUnsubscribed"]=> bool(false) ["ListID"]=> int(4) ["ListName"]=> string(4) "TEST" ["UnsubscribedAt"]=> string(0) "" }
array(7) { ["ContactID"]=> int(7) ["ID"]=> int(8) ["IsActive"]=> bool(true) ["IsUnsubscribed"]=> bool(false) ["ListID"]=> int(4) ["ListName"]=> string(4) "TEST" ["UnsubscribedAt"]=> string(0) "" }
array(7) { ["ContactID"]=> int(8) ["ID"]=> int(9) ["IsActive"]=> bool(true) ["IsUnsubscribed"]=> bool(false) ["ListID"]=> int(4) ["ListName"]=> string(4) "TEST" ["UnsubscribedAt"]=> string(0) "" }
array(7) { ["ContactID"]=> int(9) ["ID"]=> int(10) ["IsActive"]=> bool(true) ["IsUnsubscribed"]=> bool(false) ["ListID"]=> int(4) ["ListName"]=> string(4) "TEST" ["UnsubscribedAt"]=> string(0) "" }
array(7) { ["ContactID"]=> int(10) ["ID"]=> int(11) ["IsActive"]=> bool(true) ["IsUnsubscribed"]=> bool(false) ["ListID"]=> int(4) ["ListName"]=> string(4) "TEST" ["UnsubscribedAt"]=> string(0) "" }
array(7) { ["ContactID"]=> int(11) ["ID"]=> int(12) ["IsActive"]=> bool(true) ["IsUnsubscribed"]=> bool(false) ["ListID"]=> int(4) ["ListName"]=> string(4) "TEST" ["UnsubscribedAt"]=> string(0) "" }
array(7) { ["ContactID"]=> int(12) ["ID"]=> int(13) ["IsActive"]=> bool(true) ["IsUnsubscribed"]=> bool(false) ["ListID"]=> int(4) ["ListName"]=> string(4) "TEST" ["UnsubscribedAt"]=> string(0) "" }
array(7) { ["ContactID"]=> int(13) ["ID"]=> int(14) ["IsActive"]=> bool(true) ["IsUnsubscribed"]=> bool(false) ["ListID"]=> int(4) ["ListName"]=> string(4) "TEST" ["UnsubscribedAt"]=> string(0) "" }
array(7) { ["ContactID"]=> int(14) ["ID"]=> int(15) ["IsActive"]=> bool(true) ["IsUnsubscribed"]=> bool(false) ["ListID"]=> int(4) ["ListName"]=> string(4) "TEST" ["UnsubscribedAt"]=> string(0) "" } `
I have different ContactIDs for a given mail-address.
And no of the Lists belongs to the given ListID.
[I've changed the original list-names here.]
What is wrong with this request?
Bonjour,
je souhaite obtenir tous les emails envoyés depuis une date (13/12/2015 00:00:00 par ex) mais impossible d'obtenir toutes les données.
J'utilise cette requete :
https://api.mailjet.com/v3/REST/messagesentstatistics?Limit=1000&FromTS=1449961200
Merci
bonjour,
dans quel repertoire copier les fichiers api mailjet (no composer v3) chez mon hebergeur?
en local ça fonctionne! mais pas quand je copie la meme arborescence dans httpdocs chez mon hebergeur!
merci pour votre aide.
Bonjour,
J'utilise Campaigngraphstatistics et j'ai un retour 200 de l'API, mais je n'ai pas de donnée.
Pourtant je vais bien sur une newsletter qui a été envoyée.
$response = $mailjet->get(Resources::$Campaigngraphstatistics, ['filters' => ['Open' => true, 'IDS' => $id]]);
[private] status => (int) 200
[private] success => true
[private] body => array(
'Count' => (int) 0,
'Data' => array(),
'Total' => (int) 0
)
Merci pour vos lumières
Hello,
I would like to update the information in a newsletter. I use the method "put" but I have a 404 error returned by the API.
$params = array(
'Title' => $data['name'],
'Locale' => $data['locale'],
'Sender' => $data['sender'],
'SenderEmail' => $data['senderEmail'],
'Subject' => $data['subject'],
'ContactsListID' => $data['listId'],
'ID' => '123456'
);
$response = $mailjet->put(Resources::$Newsletter, ['body' => $params]);
Can you help me please ? (Creating works correctly)
Thank you
Hi,
I've been using the API to send transac emails.
Once I've sent a email though the api, I get the "messageId" form the response and store it to my own db. Notice that I also use the "MJ-CustomID" header field to affect this email to our own internal event called "email_campaign_7".
After that I used (though the API) the messagesentstatistics resource with the parameter CustomID=email_campaign_7 to get all the message sent on this event.
And here, I've noticed that the messsageId stored in the db is 19421798915720714 and the messsageId obtained form the messagesentstatistics is 19421798915720710 (the last digit is different).
Am I wrong somewhere?
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.