PHP code example of web200 / magento-mod-mailjet

1. Go to this page and download the library: Download web200/magento-mod-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/ */

    

web200 / magento-mod-mailjet example snippets


use Web200\Mailjet\Model\Webservice\Email as MailjetEmail;

class Test {
    public function __construct(
        MailjetEmail $mailjetEmail
    ) {
        $this->mailjetEmail = $mailjetEmail;
    }

    public function send()
    {
        $this->mailjetEmail->setFromEmail('[email protected]');
        $this->mailjetEmail->setFromName('From Name');
        $to = [
            'Email' => '[email protected]',
            'Name' => 'Recipient Name'
        ];
        $this->mailjetEmail->setVariables(['var1' => 'test']);
        $this->mailjetEmail->setTo($to);
        $this->mailjetEmail->setTemplateId((int)$mailjetTemplateId);
        $this->mailjetEmail->send();
    }
}

$factory = $this->subscriberFactory->create();
$factory->setSubscriberLastname($lastname);
$factory->setSubscriberFirstname($firstname);
$factory->setSubscriberDob($dob);
$factory->subscribe($email);