PHP code example of nswdpc / silverstripe-structured-email
1. Go to this page and download the library: Download nswdpc/silverstripe-structured-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/ */
nswdpc / silverstripe-structured-email example snippets
// Your custom HTML body
$html = ArrayData::create([
'Name' => $name,
'CallToAction' => $link
])->renderWith('My/Template');
$data = [
'Body' => $html// Your email HTML
];
$email = StructuredEmail::create();
$email->setTo(["[email protected]", "To name"]);
$email->setFrom(["[email protected]" => "From name"]);
$email->setData($data);
// will automatically pick up StructuredEmail.ss as the template
$email->send();