PHP code example of creonit / sendpulse-mailer
1. Go to this page and download the library: Download creonit/sendpulse-mailer 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/ */
creonit / sendpulse-mailer example snippets
use Creonit\SendPulseMailer\Header\SendPulseVariableHeader;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Mailer\MailerInterface;
use Symfony\Component\Mime\Email;
class MailingController extends AbstractController
{
public function sendMail(MailerInterface $mailer)
{
$to = '[email protected]';
$message = new Email();
$message->to($to);
$message->getHeaders()
->addTextHeader('X-SendPulse-Event', 'event_name')
->add(new SendPulseVariableHeader('variable_name', 'value'));
$mailer->send($message);
}
}