Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

twip's avatar
Level 1

Mailjet laravel package usage

Hi, I'm new in the Laravel world and I have a question:

I'm using the Laravel mailjet offical package (https://github.com/mailjet/laravel-mailjet). I installed it but I don't understand how I use it. I read this https://github.com/mailjet/laravel-mailjet/blob/master/docs/usage.md and their offer some example like this:

public function campaignDraftExample(CampaignDraftContract $campaignDraftManager ) {
    // ...
    $optionalProp['Title'] = 'Friday newsletter';
    $optionalProp['SenderName'] = 'Mailjet team';
    $optionalProp['EditMode'] = 'html2';
    $campaignDraft = new CampaignDraft("en_US", "Lyubo", "[email protected]", "Laravel bundle test", "5410");
    $campaignDraft->setOptionalProperties($optionalProp);
    $campaignDraftManager->create($campaignDraft);
}

So, I created a test class and put this method inside, but I don't know what I pass to campaignDraftExample(). Ok, I should pass a "CampaignDraftContract" variable, but this is an interface and I don't understand how laravel contracts works and how to use it.

Can someone help me?

Thanks a lot

0 likes
1 reply
gmgarrison's avatar

Umm... one year later!! I'm also trying to MailJet and have found the PHP-based documentation a bit lacking. Did you end up making progress with it or giving up?

Please or to participate in this conversation.