drewlabs / envoyer-smtp
SMTP drivers for envoyer client library
v0.2.2
2024-06-21 17:04 UTC
Requires
- php: >=7.0
- drewlabs/envoyer-contracts: ^0.2.0
- psr/http-message: ^2.0
- symfony/mailer: ^6.0|^7.0
Requires (Dev)
- drewlabs/envoyer: ^0.2.0
- phpunit/phpunit: >=6.0
This package is auto-updated.
Last update: 2024-12-21 18:19:43 UTC
README
SMTP drivers provide implementations of drewlabs/envoyer
driver or client interface that uses smtp protocol internally to send text message to send email messages.
Usage
use Drewlabs\Envoyer\Drivers\Smtp\SymfonyMailerAdapter; use Drewlabs\Envoyer\Mail; use Drewlabs\Envoyer\SMTPServer; $config = require __DIR__ . '/contents/config.php'; // Create mail instance $mail = Mail::new() ->from($config['email']) ->to('azandrewdevelopper@gmail.com') ->subject('No Attachment Registration') ->content(require __DIR__ . '/contents/mail.php'); // Create SMTP server configuration object $smtpServer = new SMTPServer($config['host'], $config['port'], $config['user'], $config['password']); // Create Symfony mailer object $adapter = new SymfonyMailerAdapter($smtpServer->withEncryption('tls')); // Send mail request $result = $adapter->sendRequest($mail);