Synopsis: new Swift_Connection_NativeMail( void )
This is probably the simplest of all the connections to get to grips with. It uses PHP‘s mail() function. It takes no constructor parameters and requires no configuration.
NOTE: Due to differences between mail() in Windows and mail() on UNIX-like systems there will be small inconsistencies between running this connection on Windows and Linux/OS X. These are perfectly fine.
NOTE2: If you use this connection you will not be able to run custom SMTP commands, for obvious reasons ;)
require_once "lib/Swift.php"; require_once "lib/Swift/Connection/NativeMail.php"; $swift =& new Swift(new Swift_Connection_NativeMail());
As of version 3.2.5, you can specify what the 5th parameter of mail() is structured like by passing it to the constructor. By default this is “-oi -f %s” where %s is replaced with the actual sender address using sprintf(). You can specify your own string by doing this for example.
require_once "lib/Swift.php"; require_once "lib/Swift/Connection/NativeMail.php"; $swift =& new Swift(new Swift_Connection_NativeMail("-f%s"));
NOTE: The above will only have any affect if safe_mode is turned off in php.ini.