Location: PHPKode > scripts > SMTP4PHP > SMTP4PHP-2011/usage-example.php
<?php
/**
*
* SMTP4PHP :  SMTP for PHP
* This project is a collection of PHP 5.x classes, written in OOP style, 
* providing exception support, dedicated for sending mails fast and easily,
* with or without embedded images and/or attachments.
* 
* Copyright (c) 2011, Raul IONESCU <hide@address.com>, 
* Bucharest, ROMANIA
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @package      SMTP4PHP
* @copyright    Copyright (c) 2011, Raul IONESCU.
* @author       Raul IONESCU <hide@address.com>
* @license      http://www.opensource.org/licenses/mit-license.php The MIT License
* @access       public
*
* PHP versions 5.3 or greater
*/
define('DISPLAY_ERRORS', true);
define('DISPLAY_EXCEPTIONS', true);

set_time_limit(0);
ini_set('memory_limit',-1);
ini_set('max_execution_time',0);
ini_set('ignore_user_abort','On');
ini_set('display_errors', (DISPLAY_ERRORS)?(1):(0));
ini_set('display_startup_errors', (DISPLAY_ERRORS)?(1):(0));
error_reporting((DISPLAY_ERRORS)?(1):(0));
ignore_user_abort (true);
date_default_timezone_set('Europe/Bucharest');
/*///////////////////////////////////////////////////////////////////////////////////////*/
require_once('email.php');

define('MAIL_SERVER','127.0.0.1');
define('FROM_NAME','SENDER Name');
define('FROM_EMAIL','sender-email-hide@address.com');

$subject     = 'SUBJECT';
$image       = 'image.jpg';
$e = new eMAil();
$e->from = new eMailUser(FROM_NAME, FROM_EMAIL);
$e->to = array(new eMailUser('TO Name', 'hide@address.com'),new eMailUser(NULL, 'hide@address.com'));
$e->subject = $subject;
$e->htmlMessage = 'This is a HTML message!<br><img src="'.$e->addImage($image).'" border="0">';
$textMessage = 'This is a TEXT message!';
$e->addAttachment('Attachment.zip');

$smtp = new SMTP(MAIL_SERVER);
$smtp->send($e);
var_dump($smtp->SMTPlog);
/*///////////////////////////////////////////////////////////////////////////////////////*/
?>
Return current item: SMTP4PHP