Path

ez projects / ezswift


eZSwift

UNIX name Owner Status Version Compatible with
ezswift Kristof Coomans alpha 0.1 3.9, 3.10
eZSwift bundles the Swift PHP library for sending e-mails. Swift has many more features compared to the ezmail libary included with eZ Publish.

Take a look at the Swift website for more information.

Usage example

include_once( 'extension/ezswift/classes/ezswift.php' );
 include_once( 'extension/ezswift/swift/lib/Swift.php' );
 
$senderEmail = 'sender@example.com';
$receiverEmail = 'receiver@example.com';
 
 
$connection = eZSwift::getConnection( $senderEmail );
$swift =& new Swift( $connection );
 
//Create a message
$message =& new Swift_Message( 'Testing Swift' );
 
include_once( 'lib/version.php' );
$version = eZPublishSDK::version();
$message->headers->set( 'User-Agent', "eZ Publish, version $version" );
 
//Add plain text and html 'parts'
$message->attach( new Swift_Message_Part( 'Part 1 of message' ));
$message->attach( new Swift_Message_Part( 'Part <strong>2</strong> of message', 'text/html' ) );
 
//Add attachment
$file =& new Swift_File( ''README.txt );
$attachment =& new Swift_Message_Attachment( $file );
$message->attach( $attachment );
 
if ( $swift->send( $message, $receiverEmail, $senderEmail ) )
{
    //Send succesfully
}
else
{
 
}
 

No news yet.

This project has no reviews yet. Be the first one to review it!