adbros / nette-microsoft-mailer
v0.1
2024-09-19 17:46 UTC
Requires
- php: >=8.1
- microsoft/microsoft-graph: ^2.0
- nette/mail: ^3.0 || ^4.0
Requires (Dev)
- contributte/qa: ^0.3.1
- phpstan/extension-installer: ^1.4
- phpstan/phpstan: ^1.12
- tracy/tracy: ^2.10
README
This library provides e-mail sending via Microsoft Graph API.
How to install
composer require adbros/nette-microsoft-mailer
Register mailer
Just rewrite the default mailer service in your neon
file.
services: mail.mailer: Adbros\MicrosoftMailer\MicrosoftMailer( tenantId: 'tenant_id' clientId: 'client_id' clientSecret: 'client_secret' defaultSender: 'default_sender_email' )
Usage
Use as standard Nette Mailer.
<?php use Nette\Mail\Mailer; use Nette\Mail\Message; class SomeClass { public function __construct( private Mailer $mailer, ) { } public function sendEmail(): void { $message = new Message(); $message->setSubject('Hello World!'); $message->setHtmlBody('<h1>Hello World!</h1>'); $message->addTo('john.doe@example.org'); $this->mailer->send($message); } }