PHP code example of gourmet / email

1. Go to this page and download the library: Download gourmet/email 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/ */

    

gourmet / email example snippets


\Cake\Core\Plugin::load('Gourmet/Email');

'Email' => [
	'default' => [
		'transport' => 'default',
		'from' => 'you@localhost',
		'layout' => 'Gourmet/Email.default',
		'helpers' => ['Html', 'Gourmet/Email.Email'],
		'emailFormat' => 'both',
	]
]

// app/Template/Email/html/welcome.ctp
Welcome <?= $user['username'] 

$email = new Email();
$email->to('[email protected]');
$email->template('welcome');
$email->viewVars(['user' => ['username' => 'johndoe']]);
$email->send();