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: <3bb6c8cdbf7a15663f38193615ba9d70@php.budgegeria.de>
Date: Tue, 22 Aug 2017 09:24:01 +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 7.1, Zend 3.0, Symfony 3.2, Laravel 5.2, PHPUnit 5.6, Doctrine 2.6