PHP code example of adbros / nette-microsoft-mailer

1. Go to this page and download the library: Download adbros/nette-microsoft-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/ */

    

adbros / nette-microsoft-mailer example snippets




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('[email protected]');
        
        $this->mailer->send($message);
    }
    
}