Using the Mail Transport

To use the Mail Transport you simply need to call Swift_MailTransport::newInstance(). It's unlikely you'll need to configure the Transport.

To use the Mail Transport:

  1. Call Swift_MailTransport::newInstance().
  2. Use the returned object to create the Mailer.

Messages will be sent using the mail() function

Note: The mail() function can take a $additional_parameters parameter. Swift Mailer sets this to "-f%s" by default, where the "%s" is substituted with the address of the sender (via a sprintf()) at send time. You may override this default by passing an argument to newInstance().
<?php

require_once 'lib/swift_required.php';

//Create the Transport
$transport = Swift_MailTransport::newInstance();

//Create the Mailer using your created Transport
$mailer = Swift_Mailer::newInstance($transport);

NOTE: Documentation for version 3 is in the wiki.