Send your Message with Swiftmailer

Code
<?php

$dispatcher 
= new Swift_Events_SimpleEventDispatcher();

// a "do nothing" Transport. You may use MailTransport, SendmailTransport, etc.
$transport = new Swift_Transport_NullTransport($dispatcher);

$mailer = new Swift_Mailer($transport);

// your E-Mail message
$subject 'Your pull request';
$body 'Hi Ingo, you put .NET code into a PHP project.';
$contentType 'plain/text';

// constructor can be empty and values set with setter-methods
$message = new Swift_Message($subject$body$contentType);

$message->setFrom('john.code@localhost.php''John Code');
$message->setTo('ingo.petent@localhost.php''Ingo Petent');

$sent $mailer->send($message);

echo 
'messages sent: ' $sent PHP_EOL;
echo 
$message;
Result
messages sent: 1
Message-ID: <0a20cf1c8083a49999d0f470b2a2e4a6@php.budgegeria.de>
Date: Mon, 20 Sep 2021 15:50:10 +0200
Subject: Your pull request
From: John Code
To: Ingo Petent
MIME-Version: 1.0
Content-Type: plain/text; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Hi Ingo, you put .NET code into a PHP project.
Used Versions
PHP 8.0, Laminas MVC 3.2, Symfony 5.2, Laravel 8.28, PHPUnit 9.5, Doctrine ORM 2.8