PHP code example of buzzingpixel / corbomite-mailer
1. Go to this page and download the library: Download buzzingpixel/corbomite-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/ */
buzzingpixel / corbomite-mailer example snippets
declare(strict_types=1);
use corbomite\di\Di;
use buzzingpixel\corbomitemailer\interfaces\EmailApiInterface;
/**
* Requesting the EmailApiInterface will return an instance of \buzzingpixel\corbomitemailer\EmailApi
* You can override it with your own implementation by setting to return value of PHP-DI for
* the interface to your own implementation
*/
$emailApi = Di::diContainer()->get(EmailApiInterface::class);
$emailModel = $this->emailApi->createEmailModel([
'fromName' => 'Some Name', // Optional, fromEmail must be set
'fromEmail' => 'Some Email', // Optional
'toName' => 'Some Name', // Optional
'toEmail' => '[email protected]', // Required
'subject' => 'Some Subject', // Required
'messagePlainText' => 'Plaintext Content', // Required if messageHtml not set. Derived from messageHtml if not set
'messageHtml' => '<p>Html Content</p>', // Required if messagePlainText not set
]);
// Add the email to the queue and let the queue runner send it (recommended)
$emailApi->addEmailToQueue($emailModel);
// Send the email right away (avoid if possible)
$emailApi->sendEmail($emailModel);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.