<?
//
// +----------------------------------------------------------------------+
// | PHP Version 4                                                        |
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2002 The PHP Group                                |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.02 of the PHP license,      |
// | that is bundled with this package in the file LICENSE, and is        |
// | available at through the world-wide-web at                           |
// | http://www.php.net/license/2_02.txt.                                 |
// | If you did not receive a copy of the PHP license and are unable to   |
// | obtain it through the world-wide-web, please send a note to          |
// | license@php.net so we can mail you a copy immediately.               |
// +----------------------------------------------------------------------+
// | Author:    Damian Alejandro Fernandez Sosa <damlists@cnba.uba.ar>    |
//              Chuck Hagenbuch <chuck@horde.org>                         |
// +----------------------------------------------------------------------+
require_once 'Mail.php';


// The email as we send the email in the LMTP dialog
$to="damian@cnba.uba.ar";



// The email text (RFC822 format)
$email_headers['From']='damian@cnba.uba.ar';
$email_headers['To']='damian@cnba.uba.ar';
$email_headers['Date']='Wed, 21 Jan 2003 21:07:35 -300';
$email_headers['Subject']='testing LMTP';
$email_body="this is a test email\r\nto the lmtp server" ;



// The LMTP server
$param['host']='192.168.1.1';
// The default LMTP port
//$param['port']=2003;
$param['auth']=true;
//$param['auth']='PLAIN';
// The username to authenticate to the LMTP server
$param['username']='cyrus';
// The password to authenticate to the LMTP server
$param['password']='password';
// Should debug the LMTP connection?
//$param['debug']=true;



// Instantiate a LMTP class

if (PEAR::isError( ($lmtp= &Mail::factory('lmtp', $param ) ) ) ){
    echo 'ERROR!!!' . $lmtp->getMessage() . "\n";
    exit();
}

// Send the email
if (PEAR::isError( ($ret=$lmtp->send($to, $email_headers, $email_body) ) ) ){
    echo 'ERROR!!!' . $ret->getMessage() . "\n";
}else{
    echo "Email was sent successfuly!!!\n";
}


?>