├── tutorials ├── .gitignore ├── digest │ ├── screenshots │ │ ├── hero.png │ │ ├── mail.png │ │ ├── sales.png │ │ ├── content.png │ │ ├── contents.png │ │ ├── navbar.png │ │ └── social.png │ ├── variables.json │ ├── index.mjml │ └── README.md ├── receipt │ ├── screenshots │ │ ├── hero.png │ │ ├── item.png │ │ ├── mail.png │ │ ├── footer.png │ │ ├── header.png │ │ ├── items.png │ │ ├── order.png │ │ ├── preview.png │ │ ├── total.png │ │ └── suggestions.png │ ├── variables.json │ └── index.mjml ├── welcome │ ├── screenshots │ │ ├── copy.png │ │ ├── mail.png │ │ ├── footer.png │ │ ├── header.png │ │ ├── social.png │ │ ├── hero_male.png │ │ ├── categories.png │ │ └── hero_female.png │ ├── variables.json │ ├── index.mjml │ └── README.md ├── abandoned_cart │ ├── screenshots │ │ ├── cart.png │ │ ├── hero.png │ │ ├── mail.png │ │ ├── footer.png │ │ ├── navbar.png │ │ ├── social.png │ │ ├── hero_cart.png │ │ └── youwilllovethat.png │ ├── variables.json │ ├── index.mjml │ └── README.md ├── email_sender │ └── v0.1 │ │ ├── config │ │ └── index.js │ │ ├── send-email.js │ │ ├── templates │ │ ├── welcome │ │ │ ├── variables.json │ │ │ └── index.mjml │ │ ├── abandoned_cart │ │ │ ├── variables.json │ │ │ └── index.mjml │ │ └── receipt │ │ │ ├── variables.json │ │ │ └── index.mjml │ │ ├── render-mjml.js │ │ ├── read-files.js │ │ ├── package.json │ │ ├── services │ │ ├── mailjet-sender.js │ │ └── mjml-api.js │ │ ├── index.js │ │ ├── test │ │ ├── mailjet-sender.test.js │ │ └── mjml-api.test.js │ │ └── README.md ├── LICENSE.md └── README.md ├── .gitignore ├── samples ├── ecommerce │ ├── img │ │ ├── photo1.jpg │ │ ├── photo2.jpg │ │ └── photo3.jpg │ ├── media │ │ ├── ecommerce1.png │ │ ├── ecommerce2.png │ │ ├── ecommerce3.png │ │ ├── ecommerce4.png │ │ └── ecommerce5.png │ ├── README.md │ └── test.php ├── white_label │ ├── img │ │ ├── vs3n.png │ │ └── mailjet.jpg │ ├── media │ │ ├── white_label1.png │ │ ├── white_label2.png │ │ └── white_label3.png │ ├── README.md │ └── test.php ├── composer.json ├── zigzag_loop │ ├── media │ │ ├── zigzag.png │ │ └── zigzag_design.png │ ├── template.html │ ├── test.php │ ├── README.md │ └── test_design.php ├── all_in_one_transac │ ├── media │ │ ├── all1.png │ │ ├── all2.png │ │ ├── all3.png │ │ └── all4.png │ ├── img │ │ ├── writer-1.png │ │ ├── writer-2.png │ │ ├── writer-3.png │ │ ├── writer-4.png │ │ ├── contributor-1.png │ │ ├── contributor-2.png │ │ ├── contributor-3.png │ │ └── contributor-4.png │ ├── README.md │ └── test.php ├── products_list │ ├── media │ │ └── designed.png │ ├── template.html │ ├── README.md │ └── test.php ├── rss_to_email │ ├── media │ │ └── rss2email.png │ ├── template.html │ ├── README.md │ └── test.php ├── ecommerce_receipt │ ├── media │ │ └── receipt.png │ ├── README.md │ └── test.php ├── question_answer │ ├── media │ │ ├── question1.png │ │ ├── question2.png │ │ ├── question3.png │ │ └── question4.png │ ├── template.html │ ├── test.php │ └── README.md ├── electronic_ticket │ ├── media │ │ ├── MailjetAir1.png │ │ └── MailjetAir2.png │ ├── README.md │ └── test.php ├── conf.php └── README.md ├── LICENCE └── README.md /tutorials/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .credentials 3 | npm-debug.log 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | vendor/* 2 | composer.lock 3 | samples/vendor/* 4 | samples/composer.lock 5 | -------------------------------------------------------------------------------- /samples/ecommerce/img/photo1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/samples/ecommerce/img/photo1.jpg -------------------------------------------------------------------------------- /samples/ecommerce/img/photo2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/samples/ecommerce/img/photo2.jpg -------------------------------------------------------------------------------- /samples/ecommerce/img/photo3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/samples/ecommerce/img/photo3.jpg -------------------------------------------------------------------------------- /samples/white_label/img/vs3n.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/samples/white_label/img/vs3n.png -------------------------------------------------------------------------------- /samples/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": { 3 | "mailjet/mailjet-apiv3-php": "1.1.0", 4 | "dg/rss-php": "^1.2" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /samples/white_label/img/mailjet.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/samples/white_label/img/mailjet.jpg -------------------------------------------------------------------------------- /samples/zigzag_loop/media/zigzag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/samples/zigzag_loop/media/zigzag.png -------------------------------------------------------------------------------- /samples/ecommerce/media/ecommerce1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/samples/ecommerce/media/ecommerce1.png -------------------------------------------------------------------------------- /samples/ecommerce/media/ecommerce2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/samples/ecommerce/media/ecommerce2.png -------------------------------------------------------------------------------- /samples/ecommerce/media/ecommerce3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/samples/ecommerce/media/ecommerce3.png -------------------------------------------------------------------------------- /samples/ecommerce/media/ecommerce4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/samples/ecommerce/media/ecommerce4.png -------------------------------------------------------------------------------- /samples/ecommerce/media/ecommerce5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/samples/ecommerce/media/ecommerce5.png -------------------------------------------------------------------------------- /tutorials/digest/screenshots/hero.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/tutorials/digest/screenshots/hero.png -------------------------------------------------------------------------------- /tutorials/digest/screenshots/mail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/tutorials/digest/screenshots/mail.png -------------------------------------------------------------------------------- /tutorials/digest/screenshots/sales.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/tutorials/digest/screenshots/sales.png -------------------------------------------------------------------------------- /tutorials/receipt/screenshots/hero.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/tutorials/receipt/screenshots/hero.png -------------------------------------------------------------------------------- /tutorials/receipt/screenshots/item.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/tutorials/receipt/screenshots/item.png -------------------------------------------------------------------------------- /tutorials/receipt/screenshots/mail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/tutorials/receipt/screenshots/mail.png -------------------------------------------------------------------------------- /tutorials/welcome/screenshots/copy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/tutorials/welcome/screenshots/copy.png -------------------------------------------------------------------------------- /tutorials/welcome/screenshots/mail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/tutorials/welcome/screenshots/mail.png -------------------------------------------------------------------------------- /samples/all_in_one_transac/media/all1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/samples/all_in_one_transac/media/all1.png -------------------------------------------------------------------------------- /samples/all_in_one_transac/media/all2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/samples/all_in_one_transac/media/all2.png -------------------------------------------------------------------------------- /samples/all_in_one_transac/media/all3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/samples/all_in_one_transac/media/all3.png -------------------------------------------------------------------------------- /samples/all_in_one_transac/media/all4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/samples/all_in_one_transac/media/all4.png -------------------------------------------------------------------------------- /samples/products_list/media/designed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/samples/products_list/media/designed.png -------------------------------------------------------------------------------- /samples/rss_to_email/media/rss2email.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/samples/rss_to_email/media/rss2email.png -------------------------------------------------------------------------------- /tutorials/digest/screenshots/content.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/tutorials/digest/screenshots/content.png -------------------------------------------------------------------------------- /tutorials/digest/screenshots/contents.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/tutorials/digest/screenshots/contents.png -------------------------------------------------------------------------------- /tutorials/digest/screenshots/navbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/tutorials/digest/screenshots/navbar.png -------------------------------------------------------------------------------- /tutorials/digest/screenshots/social.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/tutorials/digest/screenshots/social.png -------------------------------------------------------------------------------- /tutorials/receipt/screenshots/footer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/tutorials/receipt/screenshots/footer.png -------------------------------------------------------------------------------- /tutorials/receipt/screenshots/header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/tutorials/receipt/screenshots/header.png -------------------------------------------------------------------------------- /tutorials/receipt/screenshots/items.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/tutorials/receipt/screenshots/items.png -------------------------------------------------------------------------------- /tutorials/receipt/screenshots/order.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/tutorials/receipt/screenshots/order.png -------------------------------------------------------------------------------- /tutorials/receipt/screenshots/preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/tutorials/receipt/screenshots/preview.png -------------------------------------------------------------------------------- /tutorials/receipt/screenshots/total.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/tutorials/receipt/screenshots/total.png -------------------------------------------------------------------------------- /tutorials/welcome/screenshots/footer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/tutorials/welcome/screenshots/footer.png -------------------------------------------------------------------------------- /tutorials/welcome/screenshots/header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/tutorials/welcome/screenshots/header.png -------------------------------------------------------------------------------- /tutorials/welcome/screenshots/social.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/tutorials/welcome/screenshots/social.png -------------------------------------------------------------------------------- /samples/all_in_one_transac/img/writer-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/samples/all_in_one_transac/img/writer-1.png -------------------------------------------------------------------------------- /samples/all_in_one_transac/img/writer-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/samples/all_in_one_transac/img/writer-2.png -------------------------------------------------------------------------------- /samples/all_in_one_transac/img/writer-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/samples/all_in_one_transac/img/writer-3.png -------------------------------------------------------------------------------- /samples/all_in_one_transac/img/writer-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/samples/all_in_one_transac/img/writer-4.png -------------------------------------------------------------------------------- /samples/ecommerce_receipt/media/receipt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/samples/ecommerce_receipt/media/receipt.png -------------------------------------------------------------------------------- /samples/question_answer/media/question1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/samples/question_answer/media/question1.png -------------------------------------------------------------------------------- /samples/question_answer/media/question2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/samples/question_answer/media/question2.png -------------------------------------------------------------------------------- /samples/question_answer/media/question3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/samples/question_answer/media/question3.png -------------------------------------------------------------------------------- /samples/question_answer/media/question4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/samples/question_answer/media/question4.png -------------------------------------------------------------------------------- /samples/white_label/media/white_label1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/samples/white_label/media/white_label1.png -------------------------------------------------------------------------------- /samples/white_label/media/white_label2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/samples/white_label/media/white_label2.png -------------------------------------------------------------------------------- /samples/white_label/media/white_label3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/samples/white_label/media/white_label3.png -------------------------------------------------------------------------------- /samples/zigzag_loop/media/zigzag_design.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/samples/zigzag_loop/media/zigzag_design.png -------------------------------------------------------------------------------- /tutorials/welcome/screenshots/hero_male.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/tutorials/welcome/screenshots/hero_male.png -------------------------------------------------------------------------------- /tutorials/abandoned_cart/screenshots/cart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/tutorials/abandoned_cart/screenshots/cart.png -------------------------------------------------------------------------------- /tutorials/abandoned_cart/screenshots/hero.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/tutorials/abandoned_cart/screenshots/hero.png -------------------------------------------------------------------------------- /tutorials/abandoned_cart/screenshots/mail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/tutorials/abandoned_cart/screenshots/mail.png -------------------------------------------------------------------------------- /tutorials/receipt/screenshots/suggestions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/tutorials/receipt/screenshots/suggestions.png -------------------------------------------------------------------------------- /tutorials/welcome/screenshots/categories.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/tutorials/welcome/screenshots/categories.png -------------------------------------------------------------------------------- /tutorials/welcome/screenshots/hero_female.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/tutorials/welcome/screenshots/hero_female.png -------------------------------------------------------------------------------- /samples/all_in_one_transac/img/contributor-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/samples/all_in_one_transac/img/contributor-1.png -------------------------------------------------------------------------------- /samples/all_in_one_transac/img/contributor-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/samples/all_in_one_transac/img/contributor-2.png -------------------------------------------------------------------------------- /samples/all_in_one_transac/img/contributor-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/samples/all_in_one_transac/img/contributor-3.png -------------------------------------------------------------------------------- /samples/all_in_one_transac/img/contributor-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/samples/all_in_one_transac/img/contributor-4.png -------------------------------------------------------------------------------- /samples/electronic_ticket/media/MailjetAir1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/samples/electronic_ticket/media/MailjetAir1.png -------------------------------------------------------------------------------- /samples/electronic_ticket/media/MailjetAir2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/samples/electronic_ticket/media/MailjetAir2.png -------------------------------------------------------------------------------- /tutorials/abandoned_cart/screenshots/footer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/tutorials/abandoned_cart/screenshots/footer.png -------------------------------------------------------------------------------- /tutorials/abandoned_cart/screenshots/navbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/tutorials/abandoned_cart/screenshots/navbar.png -------------------------------------------------------------------------------- /tutorials/abandoned_cart/screenshots/social.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/tutorials/abandoned_cart/screenshots/social.png -------------------------------------------------------------------------------- /tutorials/abandoned_cart/screenshots/hero_cart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/tutorials/abandoned_cart/screenshots/hero_cart.png -------------------------------------------------------------------------------- /tutorials/abandoned_cart/screenshots/youwilllovethat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mailjet/mailjet-apiv3-templating-samples/HEAD/tutorials/abandoned_cart/screenshots/youwilllovethat.png -------------------------------------------------------------------------------- /samples/rss_to_email/template.html: -------------------------------------------------------------------------------- 1 | 2 |
3 || {{product.name}} {{product.price}} | |
| {{product.name}} {{product.price}} |
This is a TEST EMAIL!
'; 19 | data['Vars'] = { 20 | title: 'Hello world!' 21 | }; 22 | 23 | s.send(data).then(response => { 24 | expect(response).to.be.an('object'); 25 | expect(response.Sent).to.be.an('array'); 26 | done(); 27 | }, error => { 28 | console.error('error', error); 29 | done(); 30 | }); 31 | }); 32 | }); 33 | }); 34 | -------------------------------------------------------------------------------- /samples/ecommerce_receipt/README.md: -------------------------------------------------------------------------------- 1 | #ECOMMERCE RECEIPT 2 | 3 | This example show how with the loops you can repeat pieces of your template. 4 | Here we display a list of articles purchased and the total of the purchase. 5 | 6 | ## Vars 7 | 8 | ```php 9 | "Vars" => array ( 10 | 'products' => [ 11 | [ 12 | 'name' => 'Minibar', 13 | 'number' => 10, 14 | 'price' => '$5.00', 15 | 'totalprice' => '$50.00' 16 | ], 17 | [ 18 | 'name' => 'Foot massage', 19 | 'number' => 1, 20 | 'price' => '$10.00', 21 | 'totalprice' => '$10.00' 22 | ], 23 | [ 24 | 'name' => 'Dinner', 25 | 'number' => 2, 26 | 'price' => '$50.00', 27 | 'totalprice' => '$100.00' 28 | ], 29 | [ 30 | 'name' => 'Nights', 31 | 'number' => 2, 32 | 'price' => '$150.00', 33 | 'totalprice' => '$300.00' 34 | ] 35 | 36 | ] , 37 | 'vat'=> "$100.00", 38 | 'totalprice'=> "$460.00" 39 | ), 40 | 41 | ``` 42 | 43 | ## Template source 44 | 45 | ```html 46 | {% for article in var:products %} 47 | {{ article.name }} 48 | {{article.number}} 49 | {{article.price}} 50 | {{article.totalprice}} 51 | {% endfor%} 52 | {{var:vat}} 53 | {{var:totalprice}} 54 | ``` 55 | 56 | ## Result 57 | 58 |  59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /samples/products_list/README.md: -------------------------------------------------------------------------------- 1 | #PRODUCT LIST 2 | 3 | This example show how with the loops you can repeat pieces of your template. 4 | 5 | ## Vars 6 | 7 | ``` 8 | "Vars" => array ( 9 | 'products' => [ 10 | [ 11 | [ 12 | 'img' => 'http://191n.mj.am/img/191n/3s/x41.jpg', 13 | 'name' => 'MAVA PULLOVER', 14 | 'price' => '55€' 15 | ],[ 16 | 'img' => 'http://191n.mj.am/img/191n/3s/x4l.jpg', 17 | 'name' => 'NEOS PURPLE SKIRT', 18 | 'price' => '45€' 19 | ],[ 20 | 'img' => 'http://191n.mj.am/img/191n/3s/x4m.jpg', 21 | 'name' => 'JENSEN TOP', 22 | 'price' => '78€' 23 | ] 24 | ], 25 | [ 26 | [ 27 | 'img' => 'http://191n.mj.am/img/191n/3s/x42.jpg', 28 | 'name' => 'LEADY JACKET', 29 | 'price' => '110€' 30 | ], 31 | [ 32 | 'img' => 'http://191n.mj.am/img/191n/3s/x4p.jpg', 33 | 'name' => 'FUNKY PANTS', 34 | 'price' => '73€' 35 | ], 36 | [ 37 | 'img' => 'http://191n.mj.am/img/191n/3s/x43.jpg', 38 | 'name' => 'PINKY DRESS', 39 | 'price' => '60€' 40 | ] 41 | ] 42 | ] 43 | ), 44 | ``` 45 | 46 | ## Template source 47 | 48 | ```html 49 | {% for line in var:products %} 50 |9 | 10 | {{var:author}} 11 | {% if var:comment!="" and var:answer=="" %} commented on {% elseif var:comment!="" %} commented an answer on {% elseif var:answer!="" %} answered {% else %} asked {% endif %} 12 | {{var:question}}: 13 | 14 |
15 | {% if var:comment=="" and var:answer!="" %} 16 |Answer:
17 |Answer:
30 |Question ({{var:view}} views):
36 | 37 |
28 |
29 | Ready to start? Jump on our tutorials:
30 | * How to create an e-receipt email template
31 | * How to create a welcome email template
32 | * How to create an abandoned cart email template
33 | * How to create a personalized digest email template
34 |
--------------------------------------------------------------------------------
/tutorials/email_sender/v0.1/README.md:
--------------------------------------------------------------------------------
1 | # Mailjet templating language console tool
2 |
3 | This email sender tool is to be used in your console.
4 |
5 | It has been built to help you test Mailjet's templating language and MJML.
6 |
7 | ## Prerequisites
8 |
9 | First of all, you will need [Node.js](https://nodejs.org/en/download/) (this tool has been tested for versions >= v7.2.1).
10 |
11 | You should have also a [Mailjet](https://www.mailjet.com/) account and a [valid API key](https://app.mailjet.com/support/what-are-the-api-key-and-secret-keys-how-should-i-use-them,109.htm). If you're not a client yet, you can [subscribe for a free account](https://app.mailjet.com/signup) (and send immediately up to 6000 free emails a month!). __Warning:__ don't use a disposable email address (gmail, yahoo, etc included), as you'll be likely to be blocked by our anti-spammer policy.
12 |
13 | Finally, you'll need an access to the [MJML API](https://mjml.io/api), actually in [open beta](https://mjml.io/api).
14 |
15 | ## Installation
16 |
17 | Download this tool directly or clone the parent directory.
18 |
19 | To install dependencies, run: `npm install`
20 |
21 | ## Configuration
22 |
23 | This tool uses two sets of API keys (_Send API_ and _MJML API_). You must provide the tool with a `.credentials` file, that contains the following environment variables:
24 |
25 | ```sh
26 | MAILJET_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
27 | MAILJET_API_SECRET=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
28 | MJML_APPLICATION_ID=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
29 | MJML_SECRET_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
30 | ```
31 |
32 | ## About your templates
33 |
34 | A template is composed of two files, one for MJML, and the other to declare templating language's variables data.
35 |
36 | These files must be created in a specific directory, matching the following pattern: `./templates/template-name`.
37 |
38 | Your MJML file must be named `index.mjml`.
39 |
40 | Your JSON variables file must be named `variables.json`.
41 |
42 | ## Run the tool
43 |
44 | To run the tool, you can use the `start` script, with your template name as the single argument. For instance: `npm start template-name`
45 |
46 | ## Testing
47 |
48 | If you want to modify this tool, we've provided you with a very succinct test suite (using [chai](chaijs.com) and [mocha](mochajs.org)). Feel free to improve it or write your own.
49 |
50 | To run it, simply hit: `npm run test`
51 |
52 | ## Any questions?
53 |
54 | Contact us via [api@mailjet.com](mailto://api@mailjet.com) or ping us on [Twitter](https://twitter.com/mailjetdev). We'll be glad to answer you and listen to your feedback.
55 |
56 | ## License
57 |
58 | MIT License
59 |
60 | Copyright (c) 2017 Mailjet
61 |
62 | Permission is hereby granted, free of charge, to any person obtaining a copy
63 | of this software and associated documentation files (the "Software"), to deal
64 | in the Software without restriction, including without limitation the rights
65 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
66 | copies of the Software, and to permit persons to whom the Software is
67 | furnished to do so, subject to the following conditions:
68 |
69 | The above copyright notice and this permission notice shall be included in all
70 | copies or substantial portions of the Software.
71 |
72 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
73 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
74 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
75 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
76 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
77 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
78 | SOFTWARE.
79 |
--------------------------------------------------------------------------------
/samples/ecommerce/test.php:
--------------------------------------------------------------------------------
1 | "POST",
15 | "FromEmail" => $sender,
16 | "FromName" => "Mailjet Pilot",
17 | "Subject" => '{{ var:firstname }}, {% if var:step == "confirmorder" %}Confirmation of purchase: {{ var:productname:"" }}{% elseif var:step == "confirmshipping" %}Your {{ var:productname:"" }} is coming your way{% elseif var:step == "unavailable" %}Your purchase is unavailable: {{ var:productname:"" }}{% elseif var:step == "refund" %}Refund of your purchase {{ var:productname:"" }}{% elseif var:step == "feedback" %}Please give us some feedback about your {{ var:productname:"" }}{% endif %}',
18 | "Html-part" => $html_part,
19 | "MJ-TemplateLanguage" => true,
20 | "Vars" => array (
21 | "firstname" => "",
22 | "step" => "",
23 | "badge" => "",
24 | "level" => 0,
25 | "messagecontent" => ""
26 | ),
27 | "Recipients" => array(
28 | array(
29 | "Email" => $recipients[0],
30 | "Vars" => array(
31 | "firstname" => "Emmanuel1",
32 | "step" => "confirmorder",
33 | "productname" => "Camera",
34 | "productdescription" => "Description",
35 | "productimg" => "https://raw.githubusercontent.com/eboisgon/mailjet-template-api-samples/master/ecommerce/img/photo1.jpg",
36 | "order_id" => "1111111",
37 | "delivery" => "2 EUR",
38 | "total_price" => "30 EUR"
39 | )
40 | ),
41 | array(
42 | "Email" => $recipients[1],
43 | "Vars" => array(
44 | "firstname" => "Emmanuel2",
45 | "step" => "confirmshipping",
46 | "productname" => "Shoes",
47 | "productdescription" => "Description",
48 | "productimg" => "https://raw.githubusercontent.com/eboisgon/mailjet-template-api-samples/master/ecommerce/img/photo2.jpg",
49 | "deliverytrackurl" => "#",
50 | "delivery" => "UPS",
51 | )
52 | ),
53 | array(
54 | "Email" => $recipients[2],
55 | "Vars" => array(
56 | "firstname" => "Emmanuel3",
57 | "step" => "unavailable",
58 | "reasonunavailable" => "Restocking",
59 | "productname" => "rubik's cube",
60 | "productdescription" => "Description",
61 | "productimg" => "https://raw.githubusercontent.com/eboisgon/mailjet-template-api-samples/master/ecommerce/img/photo3.jpg",
62 | )
63 | ),
64 | array(
65 | "Email" => $recipients[3],
66 | "Vars" => array(
67 | "firstname" => "Emmanuel4",
68 | "step" => "refund",
69 | "productname" => "Camera",
70 | "productdescription" => "Description",
71 | "productimg" => "https://raw.githubusercontent.com/eboisgon/mailjet-template-api-samples/master/ecommerce/img/photo1.jpg",
72 | "order_id" => "1111111",
73 | "delivery" => "2 EUR",
74 | "total_price" => "30 EUR"
75 | )
76 | ),
77 | array(
78 | "Email" => $recipients[4],
79 | "Vars" => array(
80 | "firstname" => "Emmanuel5",
81 | "step" => "feedback",
82 | "productname" => "Shoes",
83 | "productdescription" => "Description",
84 | "productimg" => "https://raw.githubusercontent.com/eboisgon/mailjet-template-api-samples/master/ecommerce/img/photo2.jpg",
85 | )
86 | )
87 |
88 | )
89 | );
90 |
91 | $response = $mj->post(Resources::$Email, ['body' => $params]);
92 |
93 | var_dump($response->request->getUrl());
94 |
95 | var_dump($response->request->getFilters());
96 |
97 | var_dump($response->request->getBody());
98 |
99 | $response->success() && var_dump($response->getData());
100 |
101 | ?>
102 |
103 |
--------------------------------------------------------------------------------
/tutorials/digest/index.mjml:
--------------------------------------------------------------------------------
1 |
112 | Classy products
113 | for men in tune
114 | with the times
115 |
122 | Our new catalog
123 | with 1000+
124 | products and refs
125 |
132 | A trend that
133 | will never be
134 | outdated
135 |
119 | Classy products
120 | for men in tune
121 | with the times
122 |
129 | Our new catalog
130 | with 1000+
131 | products and refs
132 |
139 | A trend that
140 | will never be
141 | outdated
142 |
54 |
55 | Enough theory, it's time to write some code.
56 |
57 |
70 |
71 | MJML provides us with an interactive component, [`
160 |
161 |
174 |
175 | Mailjet's templating language comes to the rescue with [conditional statements](https://dev.mailjet.com/template-language/reference/#conditional-statements) and [built-in functions](http://dev.mailjet.com/template-language/reference/?utm_source=referrer&utm_medium=github&utm_campaign=tpl_lang_tutorial#transactional-templating#functions). The `HasOpenedSince(number_of_days)` function especially comes in handy for our matter. If the user hasn't opened any marketing campaign for the last 30 days, the piece of code contained between `{% if ... %}` and `{% endif %}` will be displayed. A good chance to trigger more sells, while the aficionados won't feel being spammed. Isn't it a win-win situation? 😎
176 |
177 | ```XML
178 |
179 |
54 |
55 | Enough theory, it's time to write some code.
56 |
57 |
70 |
71 | As you may notice in the code below, the main container is not a `|
243 | |
251 |
252 | {{ item.title }} 253 | Color: {{ item.color }} 254 | Size: {{ item.size }} 255 | Price: {{ item.price.currency }}{{ item.price.amount }} 256 | |
257 |
| `, ` | `, etc.) wrapped in a [` 266 | 267 | 270 | 271 | 🔝 272 | 273 | 274 | 275 | #### How much is it? 276 | 277 | Here again, we use a [` SUBTOTAL: | {{ var:order.subtotal.currency }}{{ var:order.subtotal.amount }} | 289 | 290 | #### Click, click, click. 291 | 292 | Last but not list, we display our two CTAs using two [` 307 | 308 | 🔝 309 | 310 | 311 | 312 | ### You will love that 313 | 314 | We've already covered that part in our previous tutorials. Want to discover how to implement this section? Go [this way](../receipt/#i-bet-you-want-to-buy-more-things). 315 | 316 | 317 | ### The social network 318 | 319 | We've already covered that part in our previous tutorials. Want to discover how to implement this section? Go [this way](../welcome/#the-social-network). 320 | 321 | 322 | ## Conclusion 323 | 324 | Here we are! Now, thanks to your very cool and practical abandoned cart email, no cart on your website will be left in despair, longing forever for their customer to come back. Thank you for them! 325 | 326 | We'd love to have your feedback about this first tutorial, so ping us on [Twitter](https://twitter.com/mailjetdev) or come and chat on the [MJML slack channel](https://slack.mjml.io/?utm_source=referrer&utm_medium=github&utm_campaign=tpl_lang_tutorial)! 327 | 328 | You want to be informed about other tutorials and nice tech articles? Subscribe to our [dev only newsletter](https://dev.mailjet.com/community/?utm_source=referrer&utm_medium=github&utm_campaign=tpl_lang_tutorial#newsletter) to stay tuned! 329 | 330 | 331 | 332 | 🔝 333 | -------------------------------------------------------------------------------- |
|---|