Location: PHPKode > projects > P3Mailer > p3mailer/examples/simple.php
<?php

/**
 * @author  Samuel Carlier
 * @package P3Base_Mailer_Examples
 */
try {

	require '../p3base/P3Base.php';

	$envelope = new P3Base_Mailer_Envelope;
	$envelope->setSubject('P3Mailer test mail');
	
	$envelope->setFrom('hide@address.com', 'name');
	$envelope->addTo('hide@address.com', 'name');

	$envelope->setHTMLMessage('this is a <b>html</b> <font color="#cccccc">message</font>');
	$envelope->setTextMessage('P3mailer text');

	$mailer = new P3Base_Mailer_Handler_SMTP('localhost');
	$mailer->perform($envelope);

	//close connection
	$mailer = null;
	
} catch(Exception $e) {
	echo '<hr /><b>Error Occured</b><br />';
	echo nl2br($e->getMessage());
}

?>
Return current item: P3Mailer