lianhua/easy-mailjet

This package is abandoned and no longer maintained. No replacement package was suggested.

A simple library for sending email through mailjet service

1.0 2020-03-22 12:23 UTC

README

Build Status BCH compliance

Overview

A simple PHP class for sending emails through Mailjet provider

Compatibility

This library has been tested for PHP 7.3 and higher

Installation

Just use composer in your project:

composer require lianhua/easy-mailjet

If you don't use composer, clone or download this repository, all you need is inside the src directory. You'll need Lianhua Email and Mailjet API PHP Wrapper

Usage

Mailjet object

In order to create maijet object, you'll need your api keys and give them to the constructor.

$mj = new EasyMailjet("Your key", "Your secret");

Sending an email

Create an object of type Lianhua Email and give it to the function sendMail.

$mj->sendMail($email);

You'll get in return a boolean indicating if the email had been sent successfully or not.

Get mailjet detailed response

If you give a var as second parameter, you'll be able to get the response from mailjet (read Mailjet Documentation for further explanations)

$mj->sendMail($email, $res);

Send with custom ids

You can give as third and fourth parameters a custom id for the campaign and the message.

$mj->sendMail($email, $res, "campaign_id", "message_id");

Sandbox mode

You can disable the email delivering while getting a feedback from mailjet.

$mj->setSandbox(true);

Deduplicate mode

You can disable duplicate contacts in a campaign.

$mj->setDeduplicate(true);