How to Install and Configure

How to Install the Mailjet Module

  1. Go to the Mailjet Plugin page in the Drupal website and download the plug-in, or copy the download link to your clipboard.
  2. Log into Drupal as the Administrator, click on ‘Modules’ and then on ‘Install new module’.

    img0

  3. Paste the plug-in download link in the ‘Install from a URL’ field, or choose the downloaded plug-in file from the ‘Upload a module or theme archive to install’ menu. Afterwards click on ‘Install’.

    img0a

  4. Once the installation is successful, from the Drupal admin menu select ‘Configuration’.

    img1

  5. From the ‘System’ section choose ‘Mailjet Settings’.

    img2

  6. In the Mailjet Settings page, select the ‘API’ tab.

    img3

    You will need to enter your Mailjet API Key and Secret Key. This will replace your default SMTP information and allow Drupal to send all your emails through Mailjet. You can find the API Key and Secret Key information in your Mailjet API Key Management page.

    Note

    If you do not have a Mailjet account, please create one now by clicking the ‘Register’ button on the API tab, or go directly to the Mailjet Signup page.

  7. Enter your API Key and Secret Key as shown below, and then click on ‘Save configuration’.

    img4

    Important

    The API and Secret keys are authentication tokens only known by you and Mailjet. Please keep them private.

    Once your configuration is saved, your Mailjet account will be linked to Drupal. Your Drupal contacts will be automatically transferred to a new Mailjet Contact List, along with the contact properties configured in Drupal.

How to Configure the Mailjet Module

Select Mailjet Sender Email Address

The Mailjet module uses the sender email address you have selected for your website in the Drupal settings.

Important

In order to be able to successfully send emails via the Mailjet module, the sender email needs to be verified with Mailjet. Visit the “Sender Domains & Addresses” section of your Mailjet account to view your sender addresses and domains.

To view / change your site’s email address, select ‘Configuration’ → ‘System’ → ‘Site Information’ from the Drupal admin.

img4a1

Then enter an email address that is verified in Mailjet and click on ‘Save Configuration’ to save your settings.

img4a2

Add Mailjet Settings Shortcut

To be able to quickly access the Mailjet module, it is useful to add a shortcut to it to your ‘Default shortcuts’.

Simply go into ‘Mailjet Settings’ and click on the + sign next to the module name.

img4a

The shortcut will immediately be added to the respective menu.

img4b

Settings Tab

Let’s examine the sections in the Settings tab and how you can configure them. Please remember that for any changes to take place, you need to click on ‘Save Settings’ afterwards!

img5

Send Test Email

The first step is to send a test email and verify that the Mailjet configuration is correct.

Click on the ‘Send test email’ button.

img6

Enter an email address and click ‘Send Test Message’.

img7

Check your inbox for an email with the subject “Your test mail from Mailjet”.

Note

If you do not receive the test email in your Inbox, make sure to check the Spam folder, as well as your email sending configurations. If after that you are still experiencing difficulties receiving the test messages, please reach out to our awesome Support Team, who are always eager to help!

Excellent, the Mailjet module is correctly configured!

Send Emails through Mailjet

Now for the most important setting - check the “Send emails through Mailjet” box.

img8

By enabling this checkbox, you are allowing Mailjet to send all of the emails emanating from your Drupal environment (transactional emails and marketing campaigns). With Mailjet’s SMTP relay, you will have access to real-time statistics, triggered marketing events, order statuses, ROI on campaigns, optimized email deliverability and much more.

Allow HTML

img8a

Tick this checkbox, if you want your emails configured and sent from Drupal to include HTML code. If the option is not enabled, Drupal emails will be automatically converted to plain text by Mailjet.

Event Tracking

The next step is to select the events to be tracked automatically with the Event Callback URL.

Event Callback (or Tracking) simply means whenever there is an event, information about it is dispatched to the provided Callback URL, containing meaningful context about the event (like the recipient email, timestamp, etc). From here, the customer can script actions to be done following it.

To start tracking email events of your choice, first choose the ones you are interested in by ticking the checkboxes next to them in Drupal. In the below example, we have selected only the ‘Unsub’ event.

img9

Note

You can see descriptions for all email events in the Mailjet Email Statuses Guide.

Then copy the displayed Event Callback URL and paste it into the Event Tracking page of your Mailjet account:

img10

  1. Tick the checkbox next to all events you want to track.
  2. Paste the URL into the ‘ENDPOINT URL’ boxes of the respective events.
  3. Click on ‘Save’ to submit the changes.

A message will appear informing you about the events you are tracking now.

img11

Note

All tracked events will be automatically recorded in a mailjet_event table in Drupal, but only if the email address of the recipient matches the email of a registered user in Drupal. You can call up this table in your PHP scripts to create automated processes in Drupal.

Account Information

The last section of the Mailjet module’s ‘Settings’ tab is the (Mailjet) Account Information.

Changes made here will be automatically reflected in the Profile page in your Mailjet account.

img12

Again, remember to click on ‘Save Settings’ when you make any changes!

Mailjet API

Configure the default SMTP settings to send all email through Mailjet.

img13

API & Secret Key: You have already entered this information but in the event that you get a new API & Secret Key, you would simply update the information here.

The ‘Event Callback URL’ section here shows the same URL displayed in the ‘Event Tracking’ section.

Mailjet Domains

This tab will list all the configured domains you have as per the Sender Domains & Addresses page of your Mailjet account. By configuring an entire domain, you can add sender addresses from that domain without having to manually validate each one.

img14

To add and configure a new domain, click on ‘Add Trusted Domain’, then enter the domain name and click on ‘Add’.

img15

Once added, you will see the domain being added to your list of trusted domains, but will be shown as ‘Inactive’.

img16

To activate it, you need to upload an empty .TXT file with the file name shown next to the root directory of the respective site. Then go back to the Mailjet Domains section and click on ‘Check Status’.

Mailjet will check if the file exists on the site, and once it finds it, the domain will be validated. Afterwards you can delete the .TXT file.

Congratulations! You have completed the installation and configured of the Mailjet module.

Using Event Tracking with Drupal Rules

You can use Event Tracking to create automated processes in Drupal, saving yourself valuable time and effort. This can be done either by creating PHP scripts yourself and implementing them in Drupal, or by using Drupal Rules.

Note

To use Drupal Rules, you need to install the Rules module in your Drupal admin.

To access the Rules module, go to ‘Configuration’ → ‘Rules’.

img11a

Select the ‘Add new rule’ option to start creating your Rule.

img11b

You will need to choose a Rule Name, as well as select the trigger - the event, which will activate the rule. You will find the Mailjet events in the drop-down menu under ‘Mailjet’ and ‘Mailjet event’.

img11c

Click on ‘Save’ to save your trigger event selection.

img11d

You will then need to select additional conditions, as well as the actions your Rule should undertake when it is triggered.

img11e

Once you have configured your Rule, click on ‘Save changes’ and it will become active!

Where can I find more information on Rules and how to configure them?

Since there are numerous ways you can configure your Rules, we highly recommend that you check Drupal’s All About Rules guide.