Skip to content
This repository has been archived by the owner on May 10, 2023. It is now read-only.
/ EasyMailjet Public archive

A simple PHP class for sending emails via Mailjet

License

Notifications You must be signed in to change notification settings

nevermille/EasyMailjet

Repository files navigation

EasyMailjet

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);

About

A simple PHP class for sending emails via Mailjet

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages