Git Product home page Git Product logo

mailjet-apiv3-php's People

Contributors

arnaudligny avatar arneee avatar axi avatar byt3sage avatar clxmstaab avatar dbakalska avatar dependabot[bot] avatar eboisgon avatar goshon avatar groupecomplus avatar hilnius avatar isetz avatar latanasov avatar mnapoli avatar mskochev avatar ngarnier avatar nmoinard avatar oleksandr-mykhailenko avatar orliesaurus avatar panigrc avatar pavlico avatar peter279k avatar pscheit avatar schojniak avatar semijoelon avatar szepeviktor avatar tomk avatar uavn avatar xirdion avatar zhivko-mailjet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mailjet-apiv3-php's Issues

Modify content-type to multipart/related instead of multipart/mixed

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"

Provide a way to get error details

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.

HTTP Error 400

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

Warning in logs: ErrorException [ 2 ]: json_decode(): option JSON_BIGINT_AS_STRING not implemented

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!

Unsubscribe a contact from a list

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.

PHP Fatal error: Call to undefined function GuzzleHttp\\Handler\\curl_reset()

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

Create Contactlist

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?

Mocking Responses

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.

noComposer

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

Sender Validate

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

Response always null

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.

Unsubscriptions not detected

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 ?

getting 400 error with any request

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

Statistics

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.

How to add Bcc aand cc

Hello,

How can i add cc and Bcc option in my parameters to send email with Mailjet ?

Thanks

apitoken sur campaign et autres pages front

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.

Envoi d'email transactionnel avec en attachement PDF

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

Invalid json input on Contactdata PUT

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 ?

Dist directory not nessecary

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. :-/

Guzzle ServerException Uncaught

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

Failed : composer require mailjet/mailjet-apiv3-php

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

Message ID différents

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é

api-mailjet

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

CustomID not persisted

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!!

Packagist declaration

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.

MessageID in response is returned as a rounded number with exponant

Hi,

I run two version of the same program using the API.

  • one on my local Apache server under PHP 5.6.10 : it works well ;
  • one on a distant server, under PHP 5.4

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 !

ContactsListManageContact not update contact Properties

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

Erreur json_encode() expects at most 2 parameters, 3 given

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);

Correct way to include an Emoji in the subject

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('&#x1f4b8;');

I don't see the implementation for /contactdata + Bad Doc

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
  1. It's password protected
  2. It seems it's your personal server @madflo ?

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;

500 Invalid floating point operation

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)

Locale is invalid error

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

Laravel

Are you planning to release a proper Laravel Mail Transport implementation?

Trying to find and delete a contact from list

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?

Obtenir le statut des emails depuis une date

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

api Mailjet ne fonctionne pas chez l'hebergeur

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.

Campaigngraphstatistics no results

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

PUT Newsletter

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

MessageID value issue

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.