PHP code example of neos / symfonymailer

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

    

neos / symfonymailer example snippets


#[Flow\Inject]
protected MailerService $mailerService;

public function sendEmail(string $from, string $to, string $subject, string $body): void
{
	$email = new Email();
	$email
		->from($from)
		->to($to)
		->subject($subject)
		->text($body);

	$mailer = $this->mailerService->getMailer();
	$mailer->send($email);
}