Plugin: Mailjet

This php helper class allows you to send transactional emails, as well as test and publish newletters. In combination with my Kirby Opener Plugin you can do all that from within the Panel.

An example template and controller are provided to help you getting started with styling your own emails using Tim Ötting’s Kirby Builder @timoetting , the responsive email markup language mjml and the logic-less templating language Mustache PHP.
But if you have your own toolchain to create responsive HTML code for emails you can continue using it.

NOTE: This is not a free plugin. In order to use it on a production server, you need to buy a license. For details on Kirby Mailjet’s license model, scroll down to the License section of this document.

Key Features

  • swap your email service from mail to kirby-mailjet and start sending emails using Mailjet
  • sent emails can be assigned to new or existing Campaigns
  • add attachements to emails
  • add and remove Contacts from Contactslists
  • test and publish Newsletters
  • Panel Fields to access Contactslists and Segments
  • Panel Buttons to send tests and publish (Kirby Opener required)
  • example how to create responsive HTML emails
  • example for newsletter double opt-in

BETA

In BETA since end of May 2017.

Example Panel Page

Compose Email or Newsletter with Kirby Builder. Test, Send and Publish it with Kirby Mailjet right from the Panel.

Example Page in Panel

Example Frontend Page

Debug helper showing Kirby Builder data and mjml markup with mustache variables highlighted

Example Page in Frontend

mjml online editor and preview created by Kirby Mailjet Plugin

Example Page in Frontend

2 Likes

Hi !
I am having trouble using your plugin.
I followed the instructions to install the plugin manually, by copying & pasting it and the other plugins required.
I activated the “mailjet.examples” and when I create a new page with the template I don’t have any preview, just an empty box. I also don’t get my contact list from mailjet.
So I guess, maybe the mustache API and Mailjet API are not functioning … as I didn’t manage to get any log files either I’m a bit stuck. Any clues ? ( I’m using the default kirby template for testing the plugin).
I’m sorry if I’m not very precise but Im a bit lost :blush:

hi @armansansd.

i assume you have proper apikey/secret/from configs set like described here. you might need to set c::set('debug', true); in your config file to track errors.

lets try finding out what is missing step by step.

  1. grab the most current version. i finally found a solution for a bug and added it this morning.

  2. try to echo the senderaddress, name and contractslists from mailjet in the default or home template like this. also echoing errors if any.

<?php 
  echo KirbyMailjet::senderAdress().'<br>';
  echo KirbyMailjet::senderName().'<br>';
  a::show(KirbyMailjet::contactslists());
  a::show(KirbyMailjet::errors());
?>
  1. to create the example page make sure its blueprint is allowed in your site.yml like this. i updated my github example page to reflect this. you can read more about the topic in the docs.
title: Site

# pages: default
pages:
  template:
    - default
    - mj-example

# ...more fields...
  1. Last point is something i missed when writing the docs. :sweat_smile: Sorry about that. I fixed the docs.
    Instead of just copying just the field definitions please copy all snippets from the plugin to you site/snippets folder as well. kirby builder does not use snippets registered by plugins but the folder and I do not recommend messing with that setting.

Hi @bnomei

First ! Thank you so much for your reply, it is working perfectly !
However, for the contact list, the trouble comes from the line :

options: http://YOUR_DOMAIN_HERE/kirby-mailjet/PLUGIN_HASH_HERE/json/contactslists.json

(im using kirby 2.4.1)
in the blueprint, I think I don’t get exactly what you mean with “plugin hash” is it the api key or secret ? Also for the domain name, is it the one hosting the website ( in my case localhost ) or the email provider.

btw : a::show(KirbyMailjet::contactslists()); return the array of the contact list so the API works :relieved:

neither key nor secret. if you are logged in at the panel and access the example page the first debug box will print an array with a single key-value-pair – the hash. you can find it in the example readme here. should look something like this…

edit: domainname is localhost(:PORT) – the text in you browsers URL bar. if you switch to production you need to change these again (unless using kirby 2.4.2 or higher)!

new release: v0.7.0-beta

  • feature complete.
  • added example for newsletter double opt-in form.