Skip to content

mailjet/drupal8-mailjet-module-apiv3

Repository files navigation

Mailjet Module - Drupal 8.x.

Mailjet APIv3 module for Drupal 8.x.

This module for Drupal 8.x. provides complete control of Drupal Email settings with Mailjet and also adds specific Drupal Commerce email marketing functionality such as triggered marketing emails and marketing campaign revenue statistics.

The Mailjet Module for Drupal 8.x configures your default Drupal SMTP settings to use Mailjet's SMTP relay with enhanced deliverability and tracking. The module also provides the ability to synchronise your Drupal opt-in contacts and send bulk and targeted emails to them with real time statistics including opens, clicks, geography, average time to click, unsubs, etc.

Mailjet is a powerful all-in-one email service provider used to get maximum insight and deliverability results from both marketing and transactional emails. Our analytics tools and intelligent APIs give senders the best understanding of how to maximize benefits for each individual contact and campaign email after email.

Requirements

Recommended modules

The following modules are not strictly required but it is nice to install them to get the full capability of the Mailjet features.

Prerequisites

For Drupal 9.x make next steps:

  1. composer require drupal/phpmailer_smtp
  2. composer require drupal/mailjet
  3. Make steps for configuration listed in Configuration section

For Drupal 8.x and below 9.x

The Mailjet plugin relies on the PHPMailer v5.2.xx for sending emails.

To install PHPMailer via composer use: composer require drupal/phpmailer

To install PHPMailer automatically:

  1. Get the latest PHPMailer version from Drupal here: https://www.drupal.org/project/phpmailer
  2. Download the .zip / .tar.gz file or copy the link to it.
  3. Upload the file or paste the link in the Extend page in your store, click Install.
  4. Verify that the module is correctly installed.

Installation

To install MAILJET via composer use: composer require drupal/mailjet

To install MAILJET automatically:

  1. Get the latest MAILJET version from Drupal here: https://www.drupal.org/project/mailjet
  2. Download the .zip / .tar.gz file or copy the link to it.
  3. Log in as administrator in your Drupal store.
  4. Upload the file or paste the link in the Extend page in your store, click Install.
  5. Verify that the module is correctly installed.
  6. Enable the Mailjet settings module on the Home > Administration > Extend page.
  7. Fill in required settings on the Home > Administration > Configuration > System Mailjet Settings > Mailjet API page.
  8. You will be required to enter API key and Secret Key from your Mailjet account. If you do not have an account yet, please create one.

Configuration

  1. The site can be set up to use the mailjet module as an email gateway, this can be easily configured, by clicking on the Settings tab => your_site/admin/config/system/mailjet, and then selecting the checkbox on the top, "Send emails through Mailjet", click "Save Settings" button on the bottom of the page. You can test that feature by sending a test email, just click the button on the top of the page Send test email in Settings tab.
  2. If you want to enable the Campaign feature, you should enable the Mailjet Campaign module, you can do that from Home > Administration > Extend page.
  3. Enabling the campaign sub module will create additional menu item in your administration menu, the new menu is called "Campaign" (/admin/config/system/mailjet/mailjet-panel/campaign).
  4. Clicking this menu item will display all the campaigns created by the administrator, from this point you will be able to create new campaigns as well, the same way you do that on mailjet.com.
  5. If you want to create a campaign simply go to the campaign page => your_site/admin/mailjet/campaign On the top right side of the page that will be presented there is a button “Create a campaign”, clicking that button will lead you to a new page presenting a form that needs to be full fill, this is the first out of three steps of creating a new campaign. The following fields are requiered - title of the campaign, language, and contact list that you already created, select your edition mode and click “Save and continue”. In the next step you should enter the “Sender name”, choose template of the email and write your email, if you want you can add links inside the email body(the "TEXT" text area) leading to your site and if a customer click on that link and purchase any product from your site this order will be recorded in the ROI stats feature where you can see how good is your conversion rate, click the “Done” button on the bottom of the email text area, and click “Continue”, in the next step which is the last one you can choose to send the email now or schedule it for later, click “Save and send”.
  6. If you enable the stats module 2 menu items will appear Dashboard where you can see the results of the mail campaigns and the Mailjet ROI stats, clicking the ROI statsyou can see the actual conversion of your campaigns, this feature will display a view which will present the campaign name, number of orders made by users who clicked on the link of your site in your email campaign.
  7. My account menu item will redirect you to the mailjet logging page.
  8. Upgrade menu link will redirect you to the pricing list of mailjet where you can pick up a plan and upgrade your account.
  9. The contacts menu item allows you to create lists that can be used for your campaigns. If you click on Contacts the list of all contact lists will be displayed on the top right side of the screen a button for creating a new contact list is available => Create a contact list. If you click on the button a short notification from mailjet with some terms will appear if you click the OK button you will be redirected to the creation form of your contacts list. Here you need to enter your list name, choose an import method => Upload from CSV, Copy/Paste from Excel, Copy/Paste from TXT, CSV, RTF. Upload your file and click Create. On the next step you should choose the import type email or mailjet_list_view click create.
  10. If you want to enable the trigger_examples sub-module you need to enable the views_bulk_operations module and apply the following patch to it:
    https://www.drupal.org/files/issues/views-vbo-patch-anon-users.patch

Author

Changelog

= 8.x-2.8 =

  • Support 9.x Drupal

= 8.x-2.7 =

  • Added processing of most used custom account field types and removed messages for end user when sync is performing.

= 8.x-2.6 =

  • Added missing .yml files

= 8.x-2.5 =

  • Added possibility to sync custom profile fields along with the user's name either on initial and single contact sync

= 8.x-2.4 =

  • Fix Single user synchronization as well as sync of contact properties
  • Fix usage for PHPMailer v6.0.7
  • Fix route path for Settings page
  • Fix usage of LANGUAGE_NONE constant in case it is not defined
  • Fix saving of Mailjet Settings forms
  • Fix namespace dependencies in info.yml file
  • Fix spaces in routing file
  • Replace deprecated assertEqual() with assertEquals()

= 8.x-2.3 =

  • Fix mailjet composer issues
  • Use Latest PHPMailer(6.0.7) not only v5.2.22
  • Use phpmailer as external library or from drupal composer
  • Change installation requirements
  • Improve subscription url building and encode base64 encoded properties
  • Convert contact properties values depends on type on confirmation
  • Remove phpmailer from plugin
  • Fix test mail
  • Fix typos

= 8.x-2.2 =

  • Add user agent to all API calls

= 8.x-2.1 =

  • Fix synchronizations
  • Fix subscription witget
  • Fix ROI stats

= 8.x-2.0 =

  • Remove depricated Global $language from stats module
  • Enable user to sort subscription form parameters
  • Add sort_fields field to the subscrioption form

= 8.x-1.3 =

  • Fix Saving settings with "Send emails through Mailjet" unchecked overrides non-default Mail system
  • Fix adding inline css and js with the subscription form

= 8.x-1.2 =

  • Update the tracking parameter

= 8.x-1.1 =

  • Fixed problem with breadcrumb navigation
  • Fixed problem with uninstall of trigger examples
  • Fixed admin URL link not working during module initial setup