PHP code example of mathieu-bour / laravel-mailjet

1. Go to this page and download the library: Download mathieu-bour/laravel-mailjet library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mathieu-bour / laravel-mailjet example snippets


return [
    // ...
    'mailjet'   => [
        'key'     => 'your-mailjet-key',
        'secret'  => 'your-mailjet-secret',
        'call'    => true, // can be set to false to mock requests
        'options' => ['version' => 'v3.1'], // additional Mailjet options, see https://github.com/mailjet/mailjet-apiv3-php#options
    ],
    // ...
];

use Windy\Mailjet\MailjetTemplateMailable;

class PasswordForgottenMail extends MailjetTemplateMailable
{
    /** @var int The Mailjet Template ID. */
    protected $templateId = 1185614;
    public $firstName;
    public $resetLink;

    public function __construct(User $user)
    {
        // You can now use {{var:firstName}} and {{var:resetLink}} variables in your Mailjet templates
        $this->firstName = $user->firstname ?? $user->username ?? '';
        $this->resetLink = 'https://mysite.com/password-reset?token=' . $user->token;
    }
}