laravel-mailjet icon indicating copy to clipboard operation
laravel-mailjet copied to clipboard

Missing dependencies?

Open FrancescJR opened this issue 3 years ago • 8 comments

It's kind of related to this one https://github.com/mailjet/laravel-mailjet/issues/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 :sweat_smile: ?)

FrancescJR avatar Mar 23 '22 15:03 FrancescJR

Hi, I'm getting the same error (as per your second one). Did you solve it?

svendehens avatar Mar 30 '22 15:03 svendehens

Nope, so far I'm just forcing the exact version 3.0.0 .... in my composer,json:

    "mailjet/laravel-mailjet": "3.0.0",

FrancescJR avatar Mar 30 '22 15:03 FrancescJR

I have the same issue

Loots-it avatar Apr 11 '22 20:04 Loots-it

Can you please share your laravel version?

mtt786 avatar May 11 '22 15:05 mtt786

Sure! right now it's : "laravel/framework": "^8.81", (8.83.11)

FrancescJR avatar May 11 '22 15:05 FrancescJR

It does work for me now, but I had to upgrade both the laravel framework to laravel 9 and this package at the same time.

Loots-it avatar May 11 '22 16:05 Loots-it

It does work for me now, but I had to upgrade both the laravel framework to laravel 9 and this package at the same time.

@Loots-it Would you mind sharing the exacts versions you have installed to get it to work please? Thanks in advance

pelomedusa avatar Jul 11 '22 09:07 pelomedusa

installing laravel 9 did fix this issue. I think you would need to install a previous mailjet version to get it running on a laravel version <=8. Alternatively you can use the API /send for transactional emails rather than using the mailjet driver.

an example I successfully used with laravel 8 is:

use Mailjet\LaravelMailjet\Facades\Mailjet; use Mailjet\Resources;

$body = [ 'FromEmail' => "[email protected]", 'FromName' => "Your Mailjet Pilot", 'Recipients' => [ [ 'Email' => "[email protected]", 'Name' => "to name" ], [ 'Email' => "[email protected]", 'Name' => "another persons name" ] ], '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!" ]; $sendTransactionalEmail = Mailjet::post(Resources::$Email,['body' => $body]);

mattHGuestServices avatar Aug 04 '22 15:08 mattHGuestServices

I encountered the same issue on Laravel 9. adding "symfony/http-client": "^6.1" to my composer.json did the trick

Owen-oj avatar Nov 13 '22 23:11 Owen-oj

Please, use laravel version 8+

oleksandr-mykhailenko avatar Nov 05 '23 17:11 oleksandr-mykhailenko

@oleksandr-mykhailenko I'm using Laravel 9 and got this issue too. symfony/http-client is a dev dependency of the laravel/framework package (since 9.*).

image

riiad avatar Nov 06 '23 10:11 riiad