1. Go to this page and download the library: Download xsga/bbphp-emailsender-core 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/ */
xsga / bbphp-emailsender-core example snippets
namespace Xsga\BBPHP\EmailSender\Core\Domain;
enum EmailMethods: string
{
case SMTP = 'smtp';
case RESEND = 'resend';
}
namespace Xsga\BBPHP\EmailSender\Core\Application\Services;
use Xsga\BBPHP\EmailSender\Core\Application\Dto\EmailDataDto;
interface SendEmailService
{
public function send(EmailDataDto $emailData): void;
}
final class EmailDataDto
{
public string $sender = '';
public string $senderName = '';
public array $recipients = [];
public array $recipientsCC = [];
public array $recipientsBCC = [];
public string $subject = '';
public string $body = '';
public array $attachments = [];
}
use Xsga\BBPHP\EmailSender\Core\Application\Dto\EmailDataDto;
use Xsga\BBPHP\EmailSender\Core\Application\Services\SendEmailService;
/** @var SendEmailService $emailService */
$emailData = new EmailDataDto();
$emailData->sender = '[email protected]';
$emailData->senderName = 'Support';
$emailData->recipients = ['[email protected]'];
$emailData->subject = 'Welcome';
$emailData->body = '<h1>Hello</h1><p>Thank you for registering.</p>';
$emailService->send($emailData);