mailjet / wordpress-mailjet-plugin-apiv3

[API v3] Mailjet for WordPress
GNU General Public License v2.0
19 stars 21 forks source link

Mailjet Email Newsletter Marketing

Includes WooCommerce automated and order emails. Design, send and track engaging marketing and transactional emails from your WordPress admin.

What's new

Description

Mailjet's official plugin on WordPress gives you access to:

Installation

  1. Log in as administrator in Wordpress.
  2. Go to Plugins > Add New
  3. Find "Mailjet Email Marketing" in the plugins directory and install it or Click "Upload plugin" and upload the mailjet-for-wordpress.zip file from GitHub
  4. Activate the Mailjet extension through the "Plugins" menu in WordPress.

Note: You must have cURL extension enabled. PHP 5.6 or later version is required.

Frequently Asked Questions

What is Mailjet?

Mailjet is an all-in-one solution to send, track and deliver both marketing and transactional emails. Its cloud-based infrastructure is unique and highly scalable with a proprietary technology that optimizes email deliverability. Mailjet can be accessed either via an easy-to-use online drag-and-drop interface or via APIs that allow developers to integrate its features within their online app or service, or its sophisticated SMTP relay.

Why use Mailjet on WordPress?
Do I need a Mailjet Account?

Yes. You can create one for free: it's easy and it only takes a few minutes.

How to get started with this plugin?

Once you have a Mailjet account, grab your Mailjet API credentials and activate the plugin. An installation wizard will guide you through. For more help on setting up the Mailjet Plugin for WordPress, feel free to check out our dedicated WordPress User Guide.

How do I create a signup form or use the contact widget?

Once your Mailjet plugin is installed and configured, click on "Appearance" in the left-side WordPress admin menu and then choose the "Widgets" section. Drag the "Mailjet Subscription Widget" widget and drop it where you want it to appear (i.e. the sidebar). For more details, please visit the official help page Adding Widgets.

In which languages is this plugin available?

The Mailjet Plugin is available in English, Spanish, French, German and Italian. Need help? Our multilingual support team is here to answer your questions in any of these languages, any day of the week, at any time via our online helpdesk.

Using filters

Set your own Thank You page

You need to have a php file with your custom template uploaded to your WordPress server. Then add the following code to your template functions.php file.


/**
 * Replace default Mailjet Thank You page template path with a your own
 * @param string $templatePath - the path of the default Mailjet Thank You page template
 * @return string
 */

add_filter( 'mailjet_thank_you_page_template', 'updateThankYouPagePath' );
function updateThankYouPagePath($templatePath) {
    return './custom_thank_you_page_path.php';
}
Replace the widget form file

You need to have a php file with your custom template uploaded to your WordPress server. Then add the following code to your template functions.php file.


/**
 * Replace default Mailjet widget form file with your own
 * @param string $templatePath - the path of the default Mailjet widget form file
 * @return string
 */

add_filter( 'mailjet_widget_form_filename', 'useMailjetCustomWidgetFormTemplate' );
function useMailjetCustomWidgetFormTemplate($templatePath) {
    return './custom_mailjet_widget_template.php';
}
Use a template for transactinal emails

Mailjet allows you to take full advantage of the template language when using Mailjet's SMTP relay. For more info see this guide. Add the following code to your template functions.php file.


/**
 * Use SMTP headers to send emails with a specific transactional template
 * and leverage templating language to supply dynamic content to the template
 */

add_filter('wp_mail', 'my_wp_mail', 99);
function my_wp_mail($args) {
    /* Provide the transac template id */
    $args['headers'] .= 'X-MJ-TemplateID:123456' . "\r\n";
    /* Enable templating language */
    $args['headers'] .= 'X-MJ-TemplateLanguage:1' . "\r\n";
    /* Send template errors to this recipient */
    $args['headers'] .= 'X-MJ-TemplateErrorReporting:admin@your-site.com' . "\r\n";
    /* Send data to the template. The vars must be defined in the template in order to accept data */
    $args['headers'] .= 'X-MJ-Vars:' .
        json_encode(
            array(
                "var1" => $args['subject'], 
                "var2" => ($recipient->first_name) ? $recipient->first_name : false, 
                "var3" => $args['message']
            )
        )  
        . "\r\n";
    return $args;
}

For developers

Before pushing any new changes, make sure you run the following command. It will remove unneeded .git directories from vendors


find vendor/ -type d -name ".git" -exec rm -rf {} \;

Screenshots

  1. The initial setup wizard will guide you through the quick steps to get started
  2. Access all features from the plugin dashboard
  3. Configure a subscription widget to collect subscribers from your site
  4. Activate and configure WooCommerce and Contact Form 7 integrations
  5. Enable order notifications for WooCommerce
  6. Configure abandoned cart notifications for WooCommerce

Changelog

6.1.2
6.1
6.1.1
6.0.1
6.0
5.5.0
5.4.6
5.4.5
5.4.3
5.4.2
5.4.1
5.4.0
5.3.7
5.3.6