Git Product home page Git Product logo

laravel-mailjet's People

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

laravel-mailjet's Issues

How to add a contact to a list

Hi,

I try to use this SDK and i'm doing this to add a contact in a list :

use Mailjet\LaravelMailjet\Facades\Mailjet;

  $mj = Mailjet::getClient();
  $response =  $mj->createContact($body);

I have this error

Symfony\Component\Debug\Exception\FatalThrowableError
Call to undefined method Mailjet\Client::createContact()

How can i call the method createContact ?
Thanks

Mailjet driver silently fails if not `from` given while sending

Hello there 👋

When using Mailjet driver, if a mail is missing the from attribute, Mailjet will silently fail and act as a successful mail even if nothing was sent.

Example:

<?php

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;

class ExampleMail extends Mailable
{
    use Queueable, SerializesModels;

    protected $data;

    public function __construct()
    {
        //
    }

    public function build()
    {
        return $this
            ->from('[email protected]') // without this, the sending fails without any exception being thrown
            ->view('mails.example')
        ;
    }
}

I think we should either allow sending email with a default from (which is what is done for other official laravel mail driver like mailtrap, etc.) or either raise an exception informing the dev of the issue.

Thank you for your work !

Laravel 9 support

A new Laravel version was released, could you please add support for it?

image

Why is documentation duplicate and inconsistent?

Hi,

The README.md seems to present the updated documentation for this package. Why docs directory still exist? They have duplicate contents and some stuff is inconsistent.

For example,
README.md shows

* `transactional`: settings to sendAPI client
* `common`: setting to MailjetClient accessible throught the Facade Mailjet
* `v4`: setting used for some DataProvider`s

docs/configuration.md shows

* `transactional`: settings for Send API
* `common`: setting to `MailjetClient` accessible through the Facade Mailjet.
* `url` (Default: `api.mailjet.com`): domain name of the API
* `version` (Default: `v3`): Mailjet API version (only working for Mailjet API v3)
* `call` (Default: `true`): Toggle if the API call is actually performed or mocked
* `secured` (Default: `true`): Toggle the usage of 'https'

Documentation: Missing Mail configuration

Hi Guys,
Do we need any of
MAIL_DRIVER=smtp
MAIL_HOST=mail
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

to run mailjet ?

Other question, does the alias is neccessery ? If yes where it sohuld go in Lumen in this case ?

Thank you

Regards

Wrong composer.json versions since v3.0.1 (swift vs symfony)

In version 3.0.1 this package switched from Swift to Symfony transports, without updating the required version of laravel/framework.

Laravel switched to Symfony mail in v9.0, which means that mailjet/laravel-mailjet v3.0.1+ can't be used used in Laravel projects using Laravel version < 9.0.

Please fix this by changing the laravel/framework requirement to ^9.0|^10.0|^11.0 in the releases that use symfony.

I don't know if it's possible to fix the releases that have already been published, but in any case you should add a note in the readme and documentation, explaining which version to install if you're using laravel <9.0.

Status says sent, but nothing is received or recorded under message events.

I am new to MailJet and the platform and could be doing something wrong, but I found the documentation to be a bit confusing.

I used this example.

It would be nice if the template example matched the sending example.

In the admin interface the JSON provided in the CURL body don't line up with the array sent by the package which seems odd.

I looked for other examples on GitHub and only found a few that were using Var instead of Variables

In any case, I get a successful response, but nothing is showing up in my Inbox, and the message events are not showing anything sent.

Any help would be much appreciated.

$mj = Mailjet::getClient();
$body = [
    'FromEmail' => "[email protected]",
    'FromName' => "Mailjet Pilot",
    'Subject' => "Your email flight plan!",
    'MJ-TemplateID' => 12345,
    'MJ-TemplateLanguage' => true,
    'Recipients' => [['Email' => "[email protected]"]],
    'Vars' => [
        'transaction_subject' => "your invoice is ready"
    ]
];
$response =  $mj->post(Resources::$Email, ['body' => $body]);
dd($response->success(), $response->getData());
true // routes/dev.php:337
array:1 [▼ // routes/dev.php:337
  "Sent" => array:1 [▼
    0 => array:3 [▼
      "Email" => "[email protected]"
      "MessageID" => 576460768801694577
      "MessageUUID" => "f61517b8-237a-4e74-b09b-70ec1276160b"
    ]
  ]
]

image

Mail Headers

Hey there!
Please, explain, how can I set custom SMTP headers, i.e. X-MJ-CustomID?

I do it like this

$id   = $this->config[ 'id' ];
        Mail::to($this->config[ 'destination' ])->send(new Email($this->config), function (Message $message) use ($id) {
            $swift = $message->getSwiftMessage();
            $swift->getHeaders()->addTextHeader('X-MJ-CustomID', $id);
        });

But mailjet doesn't return 'CustomID' during the tracking the message. (Event API)

{
   "event": "spam",
   "time": 1430812195,
   "MessageID": 13792286917004336,
   "email": "[email protected]",
   "mj_campaign_id": 0,
   "mj_contact_id": 0,
   "customcampaign": "",
   "CustomID": "helloworld",
   "Payload": "",
   "source": "JMRPP"
}

Can't set the X-MJ-CustomID header

Hi,

I tried both the SMTP configuration and the Send API, but it looks like my emails does not have the X-MJ-CustomID header.

Here is an example of a mailable:

public function build()
{
    $this->replyTo(...);

    $this->withSymfonyMessage(function (Message $message) {
        $message->getHeaders()->addTextHeader('X-MJ-CustomID', '...');

        return $message;
    });


    return $this
        ->subject('...')
        ->markdown('...')->with(...);
}

Am i doing something wrong ?

Laravel 9 / mailjet/laravel-mailjet:3.0.4
Thanks

Inline attachments don't work

Hi,
using $message->embed($pathToFile); to embed an inline attached image, results in empty img tag on received email.
Is there any workaround? Could you add inline attachment compatibility to this package?

Add support with Laravel 6.x

Hi !

Here the error message when i'm trying to install laravel-mailjet :

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Can only install one of: laravel/tinker[1.x-dev, v2.1.0].
    - Can only install one of: laravel/tinker[v2.1.0, 1.x-dev].
    - Can only install one of: laravel/tinker[1.x-dev, v2.1.0].
    - mailjet/laravel-mailjet 2.1.0 requires laravel/tinker ~1.0 -> satisfiable by laravel/tinker[1.x-dev].
    - Installation request for mailjet/laravel-mailjet ^2.1 -> satisfiable by mailjet/laravel-mailjet[2.1.0].
    - Installation request for laravel/tinker (locked at v2.1.0, required as ^2.0) -> satisfiable by laravel/tinker[v2.1.0].

for the moment i downgrade tinker with :

"laravel/tinker": "^1",

Driver [mailjet] not supported

Hi,

I seem to have an issue using this package. As the title states, when sending mails using the Mailable transport I get the "Driver [mailjet] not supported" error-message.

Here is my composer:

{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The Laravel Framework.",
    "keywords": [
        "framework",
        "laravel"
    ],
    "license": "MIT",
    "require": {
        "php": "^7.1.3",
        "aws/aws-sdk-php": "~3.0",
        "doctrine/dbal": "^2.9",
        "elic-dev/laravel-math-captcha": "^1.0",
        "erusev/parsedown": "^1.7",
        "fideloper/proxy": "^4.0",
        "jrm2k6/cloudder": "^0.6.0",
        "laravel/framework": "5.8.*",
        "laravel/telescope": "^2.0",
        "laravel/tinker": "^1.0",
        "mailjet/laravel-mailjet": "^3.0"
    },
    "require-dev": {
        "barryvdh/laravel-debugbar": "^3.2",
        "beyondcode/laravel-dump-server": "^1.0",
        "filp/whoops": "^2.0",
        "fzaninotto/faker": "^1.4",
        "laravel/telescope": "^2.0",
        "mockery/mockery": "^1.0",
        "nunomaduro/collision": "^3.0",
        "phpunit/phpunit": "^7.5"
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "autoload": {
        "psr-4": {
            "App\\": "app/"
        },
        "files": [
            "app/helpers.php"
        ],
        "classmap": [
            "database/seeds",
            "database/factories"
        ]
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "scripts": {
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi"
        ],
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi"
        ]
    }
}

I followed the instructions:

  • install using composer: composer require mailjet/laravel-mailjet
  • add provider
  • add alias
  • add the mailjet service in services.php
  • and added the env constants (in my case for Laravel 5.8, I used MAIL_DRIVER=mailjet)

I then simply send it using the Mailable instance:

Mail::to(config('mail.from.address'))->queue(new ContactFormMail($contact));

<?php

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;

class ContactFormMail extends Mailable
{
    use Queueable, SerializesModels;

    protected $data;

    /**
     * Create a new message instance.
     *
     * @return void
     */
    public function __construct(array $data)
    {
        $this->data = $data;
    }

    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {
        return $this->from(config('mail.from.address'), "TEST")
            ->subject('Contact form submitted')
            ->markdown('frontend.mails.contact')
            ->with([
                'name' => $this->data['name'],
                'phone' => $this->data['phone'],
                'email' => $this->data['email'],
                'body' => $this->data['body'],
                'ip' => $this->data['ip'],
            ]);
    }
}

Is there no support anymore for Laravel 5.8? Or am I missing something?
Thanks in advance

Incomplete installation documentation Laravel 5.7?

Hi Mailjet team,

I get the following error:
Swift_TransportException: Cannot create instance of \Mailjet\Client while API key is NULL in /workspace/vendor/mailjet/mailjet-swiftmailer/SwiftMailer/MailjetTransport.php:249

Laravel framework: 5.7.*
Mailjet/laravel-mailjet: 2.1.2

I have followed the installation steps. However this still results in the Mailjet client not receiving the API Keys.

The section on the full configuration does not say which file the changes should be performed. In I assume it should be done in the services.php file.

Here is the relevant information within my services.php

    'mailjet' => [
        'key' => env('MAILJET_APIKEY'),
        'secret' => env('MAILJET_APISECRET'),
        'transactional' => [
            'call' => true,
            'options' => [
                'url' => 'api.mailjet.com',
                'version' => 'v3.1',
                'call' => true,
                'secured' => true
            ]
        ],
        'common' => [
            'call' => true,
            'options' => [
                'url' => 'api.mailjet.com',
                'version' => 'v3',
                'call' => true,
                'secured' => true
            ]
        ]
    ],

When I echo the 2 env variables, I do get content.

I've also setup the mail from name, mail from address, and the MAIL_DRIVER env variables ('driver' => env('MAIL_DRIVER', 'mailjet'),). As well as setup the facades, aliases, providers.

Now I am not using this library, I am only using its mailTransport ability.
When trying to send mail using Laravel:

use Mailjet\LaravelMailjet\Facades\Mailjet;
use Illuminate\Support\Facades\Mail;

...

    Mail::to($user->email)->send(new MyMail());

Am I missing anything?

User is not set.

Hi!
I followed the guidelines, but i have this issue:

User is not set

image

In my .env file, i have only this variable:

MAIL_MAILER=mailjet
MAILJET_APIKEY= [my api key]
MAILJET_APISECRET= [my api secret key]
[email protected]
MAIL_FROM_NAME=NOUGATSSILVAIN

In my mail.php file:

'mailjet' => [
            'transport' => 'mailjet',
            'key' => env('MAILJET_APIKEY'),
            'secret' => env('MAILJET_APISECRET'),
            'transactional' => [
                'call' => true,
                'options' => [
                    'url' => 'api.mailjet.com',
                    'version' => 'v3.1',
                    'call' => true,
                    'secured' => true
                ]
            ],
        ],

In services.php :

'mailjet' => [
        'key' => env('MAILJET_APIKEY'),
        'secret' => env('MAILJET_APISECRET'),
    ]

And my route:

Route::get('/email', function() {

    $messageBody = "TEST MESSAGE BODY";
    Mail::raw($messageBody, function($message) {
        $message->to('[email protected]', 'TEST')
            ->subject('TEST');
        $message->from('[email protected]','My name');
    });
});

What i'm doing wrong?
Thanks a lot!
Vincent

User is not set

Hi!
I followed the guidelines, but i have this issue:

User is not set

image

In my .env file, i have only this variable:

MAIL_MAILER=mailjet
MAILJET_APIKEY= [my api key]
MAILJET_APISECRET= [my api secret key]
[email protected]
MAIL_FROM_NAME=NOUGATSSILVAIN

In my mail.php file:

'mailjet' => [
            'transport' => 'mailjet',
            'key' => env('MAILJET_APIKEY'),
            'secret' => env('MAILJET_APISECRET'),
            'transactional' => [
                'call' => true,
                'options' => [
                    'url' => 'api.mailjet.com',
                    'version' => 'v3.1',
                    'call' => true,
                    'secured' => true
                ]
            ],
        ],

In services.php :

'mailjet' => [
        'key' => env('MAILJET_APIKEY'),
        'secret' => env('MAILJET_APISECRET'),
    ]

And my route:

Route::get('/email', function() {

    $messageBody = "TEST MESSAGE BODY";
    Mail::raw($messageBody, function($message) {
        $message->to('[email protected]', 'TEST')
            ->subject('TEST');
        $message->from('[email protected]','My name');
    });
});

What i'm doing wrong?
Thanks a lot!
Vincent

Cannot create instance of \Mailjet\Client while API key is NULL

Hello i tried to use Mailjet as a new driver but i get this exception when i try to send a mail.

I configured .env , mail.php , services.php

I really need to send mails like this : Mail::to('[email protected]')->send(new MassiveEmail($subject , $bodyMessage , $files));

Because i use markdown.

Let me know where i'm doing wrong

Thanks in advance

Illuminate\Mail\Mailer::__construct() $transport error

Hi there,

We have just upgraded to Laravel 9, and am having some issues when trying to send emails. I get this error upon sending an email:

Illuminate\Mail\Mailer::__construct(): Argument #3 ($transport) must be of type Symfony\Component\Mailer\Transport\TransportInterface, Mailjet\LaravelMailjet\Transport\MailjetTransport given

I can see that in laravel/framework/src/Illuminate/Mail/Mailer.php, it requires a \Symfony\Component\Mailer\Transport\TransportInterface as the $transport argument. I can't see a way to resolve this.

Some of my enviroment details are:

composer.json

"mailjet/laravel-mailjet": "^3.0",
"symfony/mailjet-mailer": "^6.0",
"thedoctor0/laravel-mailjet-driver": "^1.0"

.env
MAIL_MAILER=mailjet

Mail config.php
'default' => env('MAIL_MAILER', 'smtp'),

'mailers' => [
        'mailjet' => [
            'transport' => 'mailjet',
        ],

Running Laravel Framework 9.8.1 with PHP 8.0.17

Thanks a lot and would really appreciate any advice.

Cannot install mailjet on Laravel 7 / spark 10.0

I'm trying to install mailjet on a project using LAravel 7.0 and Spark 10.0 but I get the following error:

Problem 1 - Can only install one of: laravel/tinker[1.x-dev, v2.4.1]. - Can only install one of: laravel/tinker[v2.4.1, 1.x-dev]. - Can only install one of: laravel/tinker[1.x-dev, v2.4.1]. - mailjet/laravel-mailjet 2.1.0 requires laravel/tinker ~1.0 -> satisfiable by laravel/tinker[1.x-dev]. - Installation request for mailjet/laravel-mailjet ^2.1 -> satisfiable by mailjet/laravel-mailjet[2.1.0]. - Installation request for laravel/tinker (locked at v2.4.1, required as ^2.0) -> satisfiable by laravel/tinker[v2.4.1].

Here is my composer.json:

"require": { "php": "^7.2.5", "fideloper/proxy": "^4.2", "fruitcake/laravel-cors": "^2.0", "guzzlehttp/guzzle": "^6.3", "laravel/framework": "^7.0", "laravel/tinker": "^2.0", "laravel/spark-aurelius": "~10.0", "laravel/ui": "^2.0", "ext-gd": "*" },

Any idea how to fix it?

Thanks,

Question: New release for php 8 missing?

Hi!

Looks like you guys already made the afford to make the code base working with php 8 - thanks for that!

@uavn I can't find a release with a tag pointing to the latest changes - am I missing something here?

Thanks in advance!

Tim

typo in MailjetMailServiceProvider.php which prevents properly loading config settings

Hi!

I found a typo in your code which prevents that the configuration in services.php can be properly loaded. The typo is in MailjetMailServiceProvider.php on line 20 and 21:

$call = $this->app['config']->get('services.mailjet.transactionnal.call', true);
$options = $this->app['config']->get('services.mailjet.transactionnal.options', array());

services.mailjet.transactionnal.call should be services.mailjet.transactional.call (single 'n').

Because of this v3 is always used instead of v3.1.

Best regards, Ramon

send API /send to AWS SQS queue

Can we utilize the API /send post and queue the request to AWS SQS which in turn would send the request onto your API endpoint.

I have the following setup:
Laravel version 9
aws sqs queue
supervisor is setup on the dev linux server

Can we also use the mailer mailjet with the Mail::to?

Using the Subject Line from a Template

I am trying to use the subject line from my template in an email. The problem is, if you don't provide a subject line to a Laravel Mailable, the following code creates a subject line based on the classname.

$message->subject(Str::title(Str::snake(class_basename($this), ' ')));

In addition, setting the subject line to a "truthy" value, results in it overriding the subject line on the template. I haven't been able to find a way around this, but if one exists I'd appreciate some advice.

[question] There is any way to perform tests ?

So i'm using laravel for a project and i also would like to use mailjet as our mail service provider.
The only problem was no good support for mailjet api in laravel, i saw this project and i said cool imma try it.
i'm about to push to production and i would like to make some tests before committing.
i've tried but it doesn't seen to be working with laravel.

Latest Update Not Working

Thanks for updating the package.
Unfortunately we still cannot work with it.

With a fresh version of Laravel I get:

Problem 1
- Can only install one of: laravel/tinker[1.x-dev, v2.5.0].
- Can only install one of: laravel/tinker[v2.5.0, 1.x-dev].
- Can only install one of: laravel/tinker[1.x-dev, v2.5.0].
- mailjet/laravel-mailjet 2.1.0 requires laravel/tinker ~1.0 -> satisfiable by laravel/tinker[1.x-dev].
- Installation request for mailjet/laravel-mailjet ^2.1 -> satisfiable by mailjet/laravel-mailjet[2.1.0].
- Installation request for laravel/tinker (locked at v2.5.0, required as ^2.5) -> satisfiable by laravel/tinker[v2.5.0].

According to the main code tab none of the files have been updated recently and the update has been applied to 1.1.0 as opposed to 2.X so I'm wondering if the work was done on the wrong version or if the work needs to be merged in.

The changes marked in the latest only show 2 archives: https://github.com/mailjet/laravel-mailjet/releases/tag/1.1.1
But the code within there seems to be referring to an outdated Laravel.

Wrong response object passed to throwError()

Hello,
If a call to the API returns enything else then success the MailJet throws an error. Which is god but its the wrong error :) . Instead of throwing whats wrong with the service it throws this one :

Argument 2 passed to Mailjet\LaravelMailjet\Services\MailjetService::throwError() must be an instance of Mailjet\LaravelMailjet\Services\Response, instance of Mailjet\Response given, called in D:\xampp\htdocs\Laravel\vendor\mailjet\laravel-mailjet\src\Services\MailjetService.php on line 39 and defined

Support for Laravel 5.6

Would be great to have support for 5.6
Anyone know a fork, before i create one by myself ?

Reply-to addresses

We’re using Mailjet as the driver for Statamic. Emails are sending perfectly but however we define the reply-to email address, they don’t seem to feed through – replying always prefills to the sender’s email address.

We’ve used other drivers in the past where this functionality works. Is this something that can be set through this package? Or is it likely a configuration issue (either between laravel-mailjet and Statamic or at the account end)?

Release 3.0.1 broken for laravel 8

Hi, can you change the release tag 3.0.1 for 4.0?
Its impact laravel 8 who needs Mailjet\LaravelMailjet\MailjetMailServiceProvider and have to set strict version in composer.json for all projects (3.0.0 instead ^3.0) ^^'

Emails aren't being sent when used with simple Auth

  • UI Version: 3.1
  • Laravel Version: 8
  • PHP Version: 7.4
  • Database Driver & Version:

Description:

Emails aren't sent on Auth user registration / verification

Steps To Reproduce:

I did all of the things below:

// User authentication routes
Auth::routes(['verify' => true]);

// MustVerifyEmail interface
class User extends Authenticatable implements MustVerifyEmail

Entered all the credentials into .env

MAIL_MAILER=mailjet
MAIL_DRIVER=mailjet
MAILJET_APIKEY=3acaf7...
MAILJET_APISECRET=34974...

Entered the transport string into config\mail.php

'default' => env('MAIL_MAILER', 'mailjet'),
'mailers' => [
	'mailjet' => [
		'transport' => 'mailjet',
	],

Added config/services.php

'mailjet' => [
		'key' => env('MAILJET_APIKEY'),
		'secret' => env('MAILJET_APISECRET'),
		'transactional' => [
			'call' => true,
			'options' => [
				'url' => 'api.mailjet.com',
				'version' => 'v3.1',
				'call' => true,
				'secured' => true
			]
		],
		'common' => [
			'call' => true,
			'options' => [
				'url' => 'api.mailjet.com',
				'version' => 'v3',
				'call' => true,
				'secured' => true
			]
		]
]

Added providers to config/app.php

// Mailjet
Mailjet\LaravelMailjet\MailjetServiceProvider::class,
Mailjet\LaravelMailjet\MailjetMailServiceProvider::class,

Yet when I go through the user registration process, email is not sent. No error of any kind. Just not sent.

Same if I navigate to <domain.com>/email/verify, and click on "click here to request another", no emails are sent. Just silent 302, no errors.

Here's proof that Auth::routes work fine, everything works fine. Except emails aren't being sent.

https://www.youtube.com/watch?v=eMDy4ZSu2jY

When I manually call MailJet API with the same credentials, emails go out perfectly fine. It's just UI / Auth is not calling MailJet API.

I tried the same with simple SMTP instead of MailJet, same problem. Emails not sent.

No exceptions / errors thrown on config error

I had a frustrating morning trying to get Mailjet to work, it was reporting emails as being sent, I was getting a success message, but in reality it never sent and was rejected by the API

I switched to another provider and lo and behold there was the error, I had not configured the from address to be an address of the registered domain

After updating the setting Mailjet worked

Could the library somehow actually report the error rather than giving a false positive?

Add support for laravel 7.x

Hello guys.
I'm using this fabulous library for handling emails inside my laravel project. Now my company needs to update Laravel to 7.x but this package does not support it since the laravel/tinker requirment does not match...

Laravel 7.x needs laravel/tinker at ^2.0 and this package is at ~1.0.

Could you update the requirement to be compatible with Laravel 7.x ?

Thank you so much.

Fetching a non-existent contact results in breaking exception

When using $result = Mailjet::get(Resources::$Contact, ['id'=>$user_email]); to fetch a non existent contact we get an exception that breaks the flow when instead it should just state the user doesn't exist otherwise we can't check before adding or deleting.

Missing dependencies?

It's kind of related to this one #53 .

The issue I am seeing is that after the upgrade to 3.0.1, it breaks saying the following:
You cannot use "Symfony\Component\Mailer\Transport\AbstractHttpTransport" as the HttpClient component is not installed. Try running "composer require symfony/http-client"

Doing some research, looks like this package is not actually required as dependency, only if you use some specific mailer, maybe that's the case, I don't know. I can see this has been added on the require here:
"symfony/mailjet-mailer": "^6.0"
but maybe it is not enough.

If I install the symfony/http-client package though, I get then a different error:

"Swift_Mailer::__construct(): Argument #1 ($transport) must be of type Swift_Transport, Symfony\Component\Mailer\Bridge\Mailjet\Transport\MailjetApiTransport given, called in /var/www/vendor/laravel/framework/src/Illuminate/Mail/MailManager.php on line 152"

do you think this is something you can help with?? (or am I completely lost 😅 ?)

Breaking Change with mailjet-apiv3-php

Hello there,

We are using the mailjet/laravel-mailjet dependency in our project, like this :

 {
     "require": {
         "mailjet/laravel-mailjet": "1.1"
     }
 }

Somewhere in our PHP files we are trying to send a new mail campaign, like this :

[...]

	public static function initCampaign($code_nl)
	{
		$call = [];
		$options = [];
		$mailjetService = new MailjetService(
			$GLOBALS['MJ_APIKEY_NL'][$code_nl]['PUBLIC'],
			$GLOBALS['MJ_APIKEY_NL'][$code_nl]['PRIVATE'],
			$call, $options
		);

		return new CampaignDraftService($mailjetService);
	}

[...]

	public function send() {
[...]
			$campaignDraftManager = self::initCampaign($newsletter->code_nl);
			$campaignDraft = new CampaignDraft('fr_FR', $newsletter->exp_nom, $newsletter->exp_email, $sujet, $idListeContacts);
			$campaignDraft->setOptionalProperties($optionalProp);
			$tabCompaign = $campaignDraftManager->create($campaignDraft);
			$content = [
				'Html-part' => $res,
				'Text-part' => 'Newsletter'
			];
				
			$campaignDraft->setContent($content);
			$campaignDraftManager->createDetailContent($tabCompaign[0]['ID'], $campaignDraft->getContent());
			$campaignDraftManager->sendCampaign($tabCompaign[0]['ID']);
[...]

All this code worked fine, since you pushed the 1.4 tag for the internal dependency mailjet-apiv3-php.

Since this repository has, in composer.json :

"mailjet/mailjet-apiv3-php": "^1.2",

As the new 1.4 tag is available, it will download 1.4 instead of 1.2 version.

In the 1.4 tag of mailjet-apiv3-php, the constructor for the \Mailjet\Client has changed, the method _isBasicAuthenticationRequired returns false, despite we sent to the service a key/secret combo variables (which we verified many times, are set and not empty).

In this situation, it returns an error and fails to send any new campaign, because the \Mailjet\Client thinks we are sending only a token, and not the key/secret combo.

We fixed it by forcing the 1.2 tag of mailjet-apiv3-php in our composer.json.

Could you fix this by updating the composer.json file of the 1.1 tag and set the dependency for mailjet-apiv3-php to the 1.2 tag which works fine ?

Silent email fail when not giving "from" with the Laravel mail driver

Hello there 👋

When using Mailjet driver, if a mail is missing the from attribute, Mailjet will silently fail and act as a successful mail even if nothing was sent.

Example:

<?php

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;

class ExampleMail extends Mailable
{
    use Queueable, SerializesModels;

    protected $data;

    public function __construct()
    {
        //
    }

    public function build()
    {
        return $this
            ->from('[email protected]') // without this, the sending fails without any exception being thrown
            ->view('mails.example')
        ;
    }
}

I think we should either allow sending email without a default from (which is what is done for other official laravel mail driver like mailtrap, etc.) or either raise an exception informing the dev of the issue.

Thank you for your work !

Driver [mailjet] not supported

I'm trying to use Mailjet as a Laravel driver, meaning I'm trying to avoid invoking it's classes directly.

I did my best to follow the documentation, which is a bit ambivalent on this use, this is what I did:

My .env

MAIL_DRIVER=mailjet
MAILJET_APIKEY=MYKEY
MAILJET_APISECRET=MYSECRET
MAIL_FROM_ADDRESS=MYMAIL
MAIL_FROM_NAME=MYNAME

My services.php return array:


...

    'mailjet' => [
        'key' => env('MAILJET_APIKEY'),
        'secret' => env('MAILJET_APISECRET'),
        'transport' => 'mailjet',   // I tried both with and without this

    ],

...

Added Mailjet\LaravelMailjet\MailjetServiceProvider::class, to my providers array and 'Mailjet' => Mailjet\LaravelMailjet\Facades\Mailjet::class to my aliases.

And here's the class which is triggering the error:


<?php

namespace App\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;

class meuResetDeSenha extends Notification
{
    use Queueable;

    /**
     * Create a new notification instance.
     *
     * @return void
     */
    public function __construct($token)
    {
        $this->token = $token;
    }

    /**
     * Get the notification's delivery channels.
     *
     * @param  mixed  $notifiable
     */
    public function via($notifiable): array
    {
        return ['mailjet'];
    }

    /**
     * Get the mail representation of the notification.
     *
     * @param  mixed  $notifiable
     */
    public function toMail($notifiable): MailMessage
    {
        return (new MailMessage)
            ->subject('Redefina sua senha ')
            ->greeting('Olá!')
            ->line('Você está recebendo este e-mail porque nós recebemos uma requisição para sua conta.')
            ->action('REDEFINIR SENHA', route('password.reset', $this->token))
            ->line('Se você não requisitou uma redefinição de senha, nenhuma ação é necessária.')
            ->markdown('vendor.notifications.email');
    }

    /**
     * Get the array representation of the notification.
     *
     * @param  mixed  $notifiable
     */
    public function toArray($notifiable): array
    {
        return [
            //
        ];
    }
}


I can't use the solution here #58 since MailjetMailServiceProvider::class no longer exists.

Call to undefined method Mailjet\LaravelMailjet\Model\Contact::setProperties()

I'm trying to use the ContactListService.updateEmail() method to update the emails of users on my list. But since updating to Laravel 9 and the the latest client version (3.0.2) this is failing each time with the error:

Call to undefined method Mailjet\LaravelMailjet\Model\Contact::setProperties() It's failing on in this part

    public function updateEmail(string $id, Contact $contact, string $oldEmail): array
    {
        $response = $this->mailjet->get(Resources::$Contactdata, ['id' => $oldEmail]);

        if (! $response->success()) {
            throw new MailjetException(0, 'ContactsListService:changeEmail() failed', $response);
        }

        $oldContactData = $response->getData();

        if (isset($oldContactData[0])) {
            $contact->setProperties($oldContactData[0]['Data']);
        }
        ....
}

When I look at the Contact model and it looks like it doesn't have a setProperties method so this error makes sense. Perhaps it needs to be setOptionalProperties instead?

Seems like a bug in the code that needs fixed?

Send link parameter for campaign template

I am trying to send a campaign template by its id in Laravel and in the template I have a button as a link, but I need to specify the link from Laravel. Could you please tell me if there is a way of doing this?
Thanks in advance,
Stefanija

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.