1. Go to this page and download the library: Download ssch/t3-messenger 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/ */
use TYPO3\CMS\Core\Mail\MailerInterface;
use TYPO3\CMS\Core\Mail\MailMessage;
use TYPO3\CMS\Core\Utility\GeneralUtility;
final class RegistrationService
{
private MailerInterface $mailer;
public function __construct(MailerInterface $mailer)
{
$this->mailer = $mailer;
}
public function register()
{
$mailMessage = GeneralUtility::makeInstance(MailMessage::class);
$mailMessage->setTo('[email protected]');
$mailMessage->setSubject('You MailerInterface');
$this->mailer->send($mailMessage);
}
}