- Introduction
- Pre-installation Instructions
- How to Install and Configure
- How to Use the Mailjet Subscription Form
- Mailjet Contacts
- Mailjet Campaigns
- Mailjet Triggered Marketing
- Mailjet Dashboard
- Mailjet My Profile
- Mailjet Upgrade
- Troubleshooting
- Conclusion
Introduction
The Mailjet Drupal module provides complete control of your Drupal Email using Mailjet. It not only replaces your default Drupal transactional SMTP service, but is also a fullstack email marketing solution for your Drupal site.
The natively embedded plugin allows you to get the benefit of Mailjet’s leading email design, deliverability and tracking inside your Drupal admin. This will help you optimize your outbound marketing and transactional email campaigns.
Mailjet has extensive reporting tools and advanced statistics to help you monitor and optimize your emails, including a special statistic for Drupal Commerce users called ROI Stats, which allows you to see how many new sales and new revenue your marketing campaign generates for your Drupal store.
Pre-installation Instructions
The Mailjet module is available for both Drupal v7.x and Drupal v8.x.
However, the functionalities differ slightly, so if you are using Drupal 7, please visit our dedicated Drupal 7 User Guide.
Required Modules
The following modules need to be installed before the Mailjet Drupal module:
- Views (download link)
- Views Bulk Operations (download link)
- Entity (download link)
- Chaos tool suite (ctools) (download link)
Recommended Modules
Although it is not required, we recommend the following modules, which will allow you to access the full Mailjet feature set:
- Commerce (download link)
- For the statistics sub module, to enable the ROI feature install:
- Views Date Format SQL (download link)
- Charts (download link)
- For the list module, you need to install:
- Viewfield (download link)
How to Install and Configure
How to Install the Mailjet Module
- Go to the Mailjet Plugin page in the Drupal website and download the plug-in (Drupal 8 version), or copy the download link to your clipboard.
-
Log into Drupal as the Administrator, click on ‘Extend’ and then on ‘Install new module’.
-
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’.
-
Once the installation is successful, from the Drupal admin menu select ‘Extend’.
-
You need to enable the Mailjet module now. Find the Mailjet section, then tick the checkbox next to the main Mailjet module.
Then scroll down until the end of the page and click on ‘Install’.
-
The main Mailjet module has now been enabled. In order to enable the sub-modules (for Campaigns, Contacts, Dashboard etc.), you need to activate it by using your Mailjet API details.
Go to ‘Configuration’ from the Drupal admin menu, then in the ‘System’ section choose ‘Mailjet Settings’.
-
A message will appear, informing you that you must enter your Mailjet API details before continuing. Click on the ‘here’ link.
-
You now 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.
-
Enter your API Key and Secret Key as shown below, and then click on ‘Save configuration’.
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 Enable the Mailjet Sub-modules
Now that your main Mailjet module is active and linked to Drupal, you can go ahead and activate the rest of the Mailjet sub-modules.
-
Select ‘Extend’ from the Drupal admin menu.
-
Find Mailjet module section, then tick the checkboxes next to each of the sub-modules and click on ‘Install’.
-
Once completed, you will see a confirmation message informing you about the modules you enabled.
The full Mailjet module is now active - congratulations!
Select Sender Email Address
The Mailjet module uses the sender email address you have selected for your website in the Drupal settings.
To view / change your site’s email address, select ‘Configuration’ → ‘System’ → ‘Basic Site Settings’ from the Drupal admin.
Then enter an email address that is verified in Mailjet and click on ‘Save Configuration’ to save your settings.
How to Configure the Mailjet Module
It is time to configure your Mailjet module settings.
To access the module, go into ‘Configuration’ and under ‘System’ select ‘Mailjet Settings’.
Add Mailjet Shortcuts
To be able to quickly access the Mailjet module sections you are most frequently using, it is useful to add them to your ‘Shortcuts’.
Simply go into ‘Mailjet Settings’, choose a tab / section and click on the star next to its name.
In the below example we will add a shortcut to Mailjet Campaigns.
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 Configuration’ afterwards!
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.
Enter an email address and click ‘Save configuration’.
Check your inbox for an email with the subject “Your test mail from Mailjet”.
Excellent, the Mailjet module is correctly configured!
Send Emails through Mailjet
Now for the most important setting - check the “Send emails through Mailjet” box.
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
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 all events.
Then copy the displayed Event Callback URL and paste it into the Event Tracking page of your Mailjet account:
- Tick the checkbox next to all events you want to track.
- Paste the URL into the ‘ENDPOINT URL’ boxes of the respective events.
- Click on ‘Save’ to submit the changes.
A message will appear informing you about the events you are tracking now.
Account Information
And the last section of the ‘Settings’ tab is the (Mailjet) Account Information.
Changes made here will be automatically reflected in the Profile page in your Mailjet account.
Again, remember to click on ‘Save configuration’ whenever you make any changes!
Mailjet API
Configure the default SMTP settings to send all email through Mailjet.
API & Secret Key: You have already entered this information when you activated the Mailjet module. However, in the event that you get a new API & Secret Key, you would simply update the information here.
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.
To add and configure a new domain, click on ‘Add Domain’, then enter the domain name and click on ‘Add’.
Once added, you will see the domain being added to your list of trusted domains, but will be shown as ‘Inactive’.
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.
To access the Rules module, go to ‘Configuration’ → ‘Rules’.
Select the ‘Add reaction rule’ option to start creating your Rule.
You will need to choose a Rule Label, as well as select the trigger - the event, which will activate the rule. You will find the Mailjet events in the ‘React to event’ drop-down menu, under ‘Mailjet’ and ‘Mailjet event’.
Click on ‘Save’ to save your trigger event selection.
You will then need to select additional conditions, as well as the actions your Rule should undertake when it is triggered.
Once you have configured your Rule, click on ‘Save’ and it will become active!
How to Use the Mailjet Subscription Form
General Information
Do you want an easy way of allowing your customers to sign up for different marketing newsletters? You can do it by using the Mailjet Subscription Form creation tool included in our module.
Set up the form by choosing the information you will collect, the contact list to add the users to, how and where the form is displayed, which customers can see it, etc.
Setting Up Multiple Subscription Forms
You have the option to create more than one Subscription Form.
This way, for example, you can create a form specifically for your Sales contacts, which will be located only on a designated page, and will be visible to customers with the respective user role. On the other hand, a standard form can be used to subscribe your regular customers to your weekly marketing campaign contact list, available in the footer of all pages and visible by all users.
How to Create a Mailjet Subscription Form
Go into ‘Mailjet Settings’ and select the ‘Signup Settings’ tab. Then click on ‘Add Subscription form’.
You are now in the Subscription Form configuration page. Let’s take a look at the options presented to you.
Title and Description
Enter a Title for your subscription form. It will be displayed internally in your list of forms.
In addition, it will be the default form title to be displayed on your website. You can change or remove it when you configure the block display.
The ‘Description’ field allows you to enter a short explanation of the purpose of the form. This is optional - if entered, the description will be displayed on your website below the title.
Form Settings
- ‘Submit Button Label’ - Enter the text that will be displayed on your ‘Subscribe’ button. Filling in this field is mandatory.
- ‘Form destination page’ - You can enter an address for a landing page after subscription - e.g. a page with information on how to complete the subscription process or a “Thank you!” page. If you leave it blank, after clicking on ‘Subscribe’ the user will remain on the same page.
Subscription Confirmation Email
After clicking on the ‘Subscribe’ button, users will be sent an automatic email, requiring them to confirm the subscription. This email will always include several pieces of information that cannot be removed:
- The URL of the website that contains the subscription form.
- A button for completing the subscription process, linking to a confirmation URL.
- The confirmation URL itself, so users can copy-paste it in the address bar of their web browsers.
The rest of the email content can be edited by using the ‘Subscription Confirmation Email’ fields:
If you do not enter any information, the default text for the respective field will be displayed.
-
Email Heading Text - Will be displayed above the website URL and subscription confirmation button.
-
Email Confirmation Button Text - Will be displayed on the subscription confirmation button.
-
Email Body Text - Will be displayed between the button and the subscription link in the email.
-
Thanks,… - Used for the end of the email, before the signature.
-
Owner - the email signature. Usually you would put your company / website name here.
-
Email Footer Text - the information you want displayed after the subscription confirmation link.
Here is an example of a customized subscription confirmation email.
Confirmation and Error Messages
These are the messages your users might receive when attempting to use the subscription form.
-
Confirmation Message - will be shown after a user clicks on the Subscribe button and the subscription confirmation email is sent successfully. You can use the
%
symbol to include the email address in the message. -
Error. Token verification failed - appears when a user tries to subscribe, but there is an issue with your Mailjet credentials.
-
Data type mismatch error - will be displayed whenever a user enters data in an incorrect format in one of the form fields. For example, you ask users to submit their age in one of the fields, so they need to enter a number, but instead they enter text.
%id
can be used to show the field label with the incorrect data format. -
Subscribe error. Please try again later! - If there was any kind of issue with the form submission, the user will see this error message.
-
The contact % is already subscribed - If the user is already subscribed, this message will be displayed. The
%
symbol is used to include the email address in the error message. -
“Thanks for subscribing… ” message - Once the user clicks on the button in the confirmation email and completes the subscription process, this message will be displayed on the landing page.
Mailjet List Selection & Configuration
Select the Mailjet contact list the users will be subscribed to, and add fields for the Mailjet contact properties you want to be included as part of the subscription form.
First, simply choose the contact list from the drop-down menu.
Afterwards select the contact properties you want included in the form. You can choose up to three properties - each selected one will appear as an additional field in the subscription form. All of the fields will be mandatory.
Add JavaScript and CSS Code
You can enter JavaScript and/or CSS code in the respective fields to modify your form design.
Machine Name
Every Subscription Form you create will be automatically assigned a Machine Name - an unique ID you can use for scripts you create. You can see it here.
Create Subscription Form
Lastly, click on ‘Create Subscription Form’ to create the form.
Edit Subscription Form
Once a form has been created, it will appear in the ‘Signup Settings’ main page. Click on ‘Edit’ to make changes to it, if needed.
Once you have edited the settings you wanted, click on ‘Edit Subscription Form’ to enact the changes you have made.
Edit Field Labels
While editing your form, you have the option to add or change the labels for the different form fields.
This is done by clicking on the ‘Edit Labels’ button.
In our example, we have 3 fields - for first name, last name and email address.
The labels you select will appear above their respective fields. If no label has been selected, nothing will be displayed.
Click on ‘Save’ to submit any changes you have made.
Delete Subscription Form
If you do not need a form you have created anymore, you can easily delete it. Simply go to the ‘Signup Settings’ tab of the Mailjet Module, click on the arrow next to the ‘Edit’ button and select the ‘Delete’ option.
Alternatively, if you are editing the form, click on ‘Delete’ at the bottom of the page to remove the form.
How to Publish a Subscription Form
You have successfully created your subscription form. Now is the time to publish it - choose where it will be displayed on your site, who is able to see it etc.
Clear Drupal Cache
You need to clear the cache in Drupal, before your subscription form becomes visible in the necessary menus. Similarly, a deleted form will be removed from the respective menus only after you clear the cache in Drupal after deletion.
To do that, go to the ‘Configuration’ section and under ‘Development’ click on ‘Performance’.
Afterward, click on ‘Clear all caches’.
Use Blocks to Publish a Subscription Form
Now that you have cleared the cache in Drupal, from the admin dashboard select ‘Structure’ and then choose the ‘Block layout’ option.
Blocks are boxes of content rendered into an area, or region, of a web page - e.g. your header, footer, sidebar etc.
From the main Blocks menu you can see all of the areas / regions a block may occupy, as well as the blocks assigned to the respective regions. The number of regions depends on the theme you are using.
To activate a subscription form block, first choose the region you want to place it in, then click on ‘Place block’ next to it.
Afterwards select it from the pop-in window by using the ‘Place block’ button.
You then have the option to configure the subscription form block. Click on ‘Save block’, when you are ready.
Configure your Subscription Form Block
By clicking on ‘Configure’ next to the form block you are able to define where the form is displayed on your website, and which users can see it.
Select Block Title
The information entered here overwrites the title you selected for your form. This way you can use a technical name for your convenience as a Form Title, and choose a Block Title more suitable for your customers.
Visibility Settings
Customize on which pages - and for whom - the sub form will be visible.
-
Content Types - if your pages are marked with a specific type, you can select the types, for which the form will appear. If none are selected, no restriction based on types will be implemented.
-
Pages - select either the pages, where it will be visible, or the ones where it is not.
-
Roles - This gives you the opportunity to choose the customer roles, for which the sub form will be visible. For example, if you have VIP users and want to create a sub form only visible by such users, you can use these restrictions.
Region Settings
Similarly to selecting the region when publishing the form, you can use the region settings to choose where your sub form will be displayed.
Remember to click on ‘Save block’ to save your settings!
Mailjet Contacts
To access your Mailjet module’s ‘Contacts’ section, go into ‘Mailjet Settings’ and select the ‘Mailjet’ tab. Then click on ‘Contacts’.
How to Manage Your Drupal Contacts
When you configure Drupal to send emails through Mailjet, all of your contacts will automatically be transferred to a Mailjet contact list called ‘Drupal Contact List’. The list will be continuously updated when new contacts are added in Drupal.
You are also able to configure Mailjet to automatically update your contact list whenever a Drupal contact unsubscribes from your mailing lists. To do that, please check our section on Event Tracking.
How to Manage Your Mailjet Contact Lists
To send out your marketing campaigns with Mailjet, you need to use contact lists that contain the contact details of all the subscribers you want to reach. You can use these contact details to further connect with your customers with email personalization, tailoring each email sent within a campaign to make your users feel unique and important.
Here you will see a list of all the contact lists you currently have on your Mailjet account. If any contacts were automatically migrated, you will also see a newly created contact list. If you have no contact lists, the area will be empty.
In this section you will be able to create, edit, duplicate, archive and delete your contact lists. You can also create new contact properties, or add emails to your Campaign Exclusion List.
For detailed information please visit our dedicated guide on Managing your contact lists.
Contact Properties
To store details about your subscribers (name, age, city, …) in your Mailjet contact list, you need to define/create the different contact properties you wish to associate with your Mailjet contacts. Once defined, you can then import your contact list details and map them to the relevant contact properties on the Mailjet side.
The inclusion of additional details regarding your subscribers will help you with personalizing emails in Mailjet, or with segmentation of the contact list for marketing campaigns, for example.
For more information on how to manage the properties, please visit the Contact Properties section of our guide on Managing Contact Lists.
Mailjet Campaigns
From within the Drupal admin, you can design beautiful marketing newsletters using Mailjet’s drag-and-drop HTML email builder, or pick from a gallery of templates. With one easy click, you can also turn your newsletter design into a template for future use. In addition, you have the option to import already created templates by pasting the HTML code in our HTML editor.
To access the Mailjet Campaigns section, go into ‘Mailjet Settings’ and select the ‘Mailjet’ tab. Then click on ‘Campaign’.
For detailed information on how to create and send your campaigns, please visit our dedicated guide.
Mailjet Triggered Marketing
General Information
Triggered Marketing is a powerful feature of Mailjet’s Drupal module. It allows you to send automated emails that are triggered by an event. This allows you, as the merchant, to help guide your clients down the conversion funnel.
To access and configure those automated emails, go into ‘Mailjet Settings’ and select the ‘Mailjet’ tab. Then click on ‘Triggered Marketing’.
On the Message types screen, you will see 3 prepared trigger templates, which are the building blocks for triggered marketing emails. As well as using the pre-built templates, you are able to use a site builder to create & modify new ones.
Updating a template is a 2-step process:
- Customize the email content.
- Set the trigger.
The following section will show how to update the following Mailjet trigger templates:
Customers who have not ordered for X months/weeks
Message Content
To edit the email content for any trigger template, click on ‘edit’.
First, select a Label and Description for the template.
You will see the Email Subject and Email Body fields - you can edit the information in both of them.
Finally, click on ‘Save message template’ once you have made your changes.
Message Trigger
Now that the email message content is updated, the next step is to set the time, at which the email will be sent - how many minutes, days, weeks or months since a customer’s last purchase date?
To set the message trigger, go to ‘Structure’, then find and click on ‘Views’.
Scroll down the page until you reach the entry “Mailjet: Customers who did not ordered for X weeks/months”. Click on the ‘Edit’ button next to it.
In the Displays section, you will be able to adjust the Filter Criteria to set ‘when’ the email will be triggered. The criteria is completely up to you.
By default, there are 2 time criteria: <= -2 weeks; <= -5 months.
The minus sign “-” represents a date in the past, or how long ago the event - in this case ‘Order Created’ - needs to have happened. So for these criteria the email will be triggered once 2 weeks have passed since the ‘created date’, and again after 5 months have passed.
To change the settings, simply click on the criteria you want to change or remove.
In the pop-in window you will see the options to configure the chosen criterion. If you want to delete it, click on ‘Remove’.
You can set criteria based on any combination of: month(s), day(s), hour(s), minute(s).
For example:
Criterion | Will be sent |
---|---|
-25 minutes | 25 minutes after the event |
-1 hour -15 minutes | 1 hour & 15 minutes later |
-2 days -3 hours | 2 days & 3 hours later |
-1 month -4 hours | 1 month & 4 hours later |
Once you have made the changes, click on ‘Apply’.
Send Anniversary Emails
Message Content
You can review and edit the content of the Anniversary Email template by clicking on ‘Edit’ next to Send anniversary emails.
First, select a Label and Description for the template.
You will see the Email Subject and Email Body fields - you can edit the information in both of them.
Finally, click on ‘Save message type’ once you have made your changes.
Message Trigger
To view / change the message trigger, go to ‘Structure’ and select ‘Views’.
Scroll down the page until you reach the entry “Mailjet: Purchase Anniversary promo view”. Click on the ‘Edit’ button.
You will see the Filter Criteria and can click on it to see how the conditions are set.
Here the value is measured in days - The email will fire between 365 days later and 366 days later… or in 12 months!
Once you have reviewed the criteria and made the changes you want (if any), click on ‘Apply’.
Abandoned Carts
The last (but certainly not least) triggered email is the Abandoned Cart. This is also referred to as “Customers whose order exceeded 30 minutes”.
Message Content
From the Message Types page, scroll down to “Send emails to customers whose order exceeded 30 minutes.” and click on ‘edit’.
As usual, within the Message text section you can edit the “Email subject” and the “Email body”.
Make the changes you want to the email subject or body, select a Display name, then click on ‘Save message type’ to submit the changes.
Message Trigger
As the name implies, this email will be sent 30 minutes after putting an item in their shopping cart without checking out and purchasing said item.
To view / change the message trigger, go to ‘Modules’, then find the ‘Views’ module and click on ‘Configure’. Then scroll down, find the entry “Mailjet: Last product exceeded 30 min” and click on ‘Edit’.
You will see the Filter Criteria and can click on it to see how the conditions are set. By default the email will be sent 30 minutes after the customer added the last product into their shopping cart but has not proceeded to checkout.
To change when the email will be sent, simply click on the default ‘Commerce Order: Created date (<= +30 minutes)’ link.
As usual, you can set the criteria based on any combination of: month(s), day(s), hour(s), minute(s) For example:
- ‘-15 minutes’ would be sent 15 minutes later.
- ’‘-1 hour -5 minutes’ would be sent 1 hour & 5 minutes later.
Once you have made your changes on the time value, just click on ‘Apply’.
Mailjet Dashboard
To view the powerful real-time analytics of your campaigns and emails, go into ‘Mailjet Settings’ and select the ‘Mailjet’ tab. Then click on ‘Dashboard’.
Select the desired time range for the stats page.
By clicking on ‘Show me the reports’ you will be able to see information on each of the recipients of the campaign:
In addition to the Email List view (default), you can view the Open Analytics and the Click Analytics in a list view or via a map view.
By default, all emails statuses are displayed. You can filter the results to display only one email status via the ‘Status’ drop down menu.
To export the email lists section to a text file, click on the ‘Download all as CSV’ button.
To update a contact list based on the results, click on ‘Export to a list’. For example, if you wish to remove all the ‘bounced’ email addresses from a particular contact list, filter the results to show only ‘Bounce’, click on ‘Export to a list’ and follow the instructions.
Mailjet My Profile
To access your Mailjet Account Information page, click on the ‘My Profile’ link in Drupal.
The sections before you include the following customizable options:
- Senders & Domains - Manage your sender addresses, SPF & DKIM records, view your SMTP information.
- Profile - Update your profile and review your Mailjet Support tickets.
- Account Preferences - Enable open & click tracking.
- REST API - API related settings and information.
- Billing - View your payment options and plan details.
- Tools - Information on the many Mailjet plugins for other platforms.
Mailjet Upgrade
If the current Mailjet plan you have does not meet your requirements, you easily select a new one. Click on ‘Upgrade’ and you will be taken to the Mailjet Pricing page to select the plan that best fits your needs!
You can see all of the Mailjet Pricing Plans and included features here. No login is required.
Troubleshooting
The Drupal Support page can assist you with answers to questions about module functionalities and common issues.
Of course, feel free to contact our Customer Support team, in case you come across any technical difficulties with the Mailjet product - our team of specialists will be more than happy to assist you! Please visit the Mailjet ‘Contact Us’ page for more information.
Conclusion
We hope you find this guide helpful. Let us know what you think of the Drupal integration process, or especially what functionality we should introduce next by emailing plugins@mailjet.com.
Happy Mailjetting,
Mailjet Plugins Team