Magento 2: Sending Email Programmatically

Magento 2 TransportBuilder uses a email templates to compose email's body. The simplest way I found to send plain text - use Zend_Mail (that is used by Magento 2 itself):

$email = new \Zend_Mail();
$email->setSubject("Feedback email");
$email->setBodyText($body);
$email->setFrom($from, $nameFrom);
$email->addTo($to, $nameTo);
$email->send();

I started searching around in the Magento 2 codebase for strings such as 'email', 'message', etc until I found something that sends out an email. I stumbled upon sendPaymentFailedEmail() in vendor/magento/module-checkout/Helper/Data.php. This sets a lot of variables but eventually ties them to a transport object, which is created through a 'transportBuilder'. This transportBuilder is an instance of \Magento\Framework\Mail\Template\TransportBuilder.

In that file, a $transport variable exists, which is an instance of \Magento\Framework\Mail\TransportInterface. Because there is an interface, there is also a regular class called \Magento\Framework\Mail\Transport. When we open the file vendor/magento/framework/Mail/Transport.php, we see that this extends Zend_Mail_Transport_Sendmail;

class Transport extends \Zend_Mail_Transport_Sendmail implements \Magento\Framework\Mail\TransportInterface

This is what you are looking for. Using DI, you'll be able to replace this transport with another email framework instead of Zend_Mail, such as Mandrill or Amazon SES.

Just be sure to include the send() method since that is the method called in sendMessage();

public function sendMessage()
{
    try {
        parent::send($this->_message);
    } catch (\Exception $e) {
        throw new \Magento\Framework\Exception\MailException(new \Magento\Framework\Phrase($e->getMessage()), $e);
    }
}

there is an often made assumption about PHPs mail() beeing outdated and not supporting any 3th. party services.
That is actually wrong, as every good 3th. party service supports an SMTP interface, and so does mail(), too.

Amazon SES does support SMTP.

and sending via SMTP with mail() is described in this answer: https://stackoverflow.com/a/14457410/716029