Mailjet Sync (Magento 2.3)
- Get mailjet template list (Marketing / Automation)
- Send Email
Send email
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();
}
}
- Sync Mail subscription / unsubscription with MailJet
- Mailjet properties firstname lastname and dob is sent when synchronisation (You need to create properties in MailJet)
- Add Firstname / Lastname / Dob in Admin subscription grid
- Add Firstname / Lastname / Dob in Magento\Newsletter\Model\Subscriber
- Send mail through mailjet api.
- Send test email to specific email, if test config is active
You can save guest subscription :
$factory = $this->subscriberFactory->create();
$factory->setSubscriberLastname($lastname);
$factory->setSubscriberFirstname($firstname);
$factory->setSubscriberDob($dob);
$factory->subscribe($email);