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: <510c450bec27fc4db9b00cc586532842@php.budgegeria.de>
Date: Mon, 10 Dec 2018 21:30:24 +0100
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 7.2, Zend 3.0, Symfony 4.0, Laravel 5.6, PHPUnit 6.5, Doctrine 2.8