Location: PHPKode > projects > P3Mailer > p3mailer/examples/file.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('<b>P3mailer</b> <i>HTML</i> <font color="green">test</font>');
	$envelope->setTextMessage('P3mailer text');

	$envelope->addFile(__FILE__); //add a file to mail

	$mailer = new P3Base_Mailer_Handler_SMTP('your mail server');
	$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