PHP code example of juanmiguelbesada / mjml-php

1. Go to this page and download the library: Download juanmiguelbesada/mjml-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

juanmiguelbesada / mjml-php example snippets




use Mjml\Client;

$applicationId = '';
$secretKey = '';
$client = new Client($applicationId, $secretKey);

$mjml = '<mjml><mj-body><mj-container><mj-section><mj-column><mj-text>Hello World</mj-text></mj-column></mj-section></mj-container></mj-body></mjml>';
$message = $client->render($mjml);

$to = '[email protected]';
$subject = 'My awesome email created with mjml';
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
mail($to, $subject, $message, $headers);

composer