Source for file test_lmtp.php
Documentation is available at test_lmtp.php
// +----------------------------------------------------------------------+
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2003 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. |
// +----------------------------------------------------------------------+
// | Authors: Chuck Hagenbuch <chuck@horde.org> |
// | Jon Parise <jon@php.net> |
// | Damian Alejandro Fernandez Sosa <damlists@cnba.uba.ar> |
// +----------------------------------------------------------------------+
require_once('Net/LMTP.php');
// The username to authenticate to the LMTP server
// The password to authenticate to the LMTP server
//you can create a file called passwords.php and store your $user,$pass,$host and $port values in it
// or you can modify this script
@require_once("./passwords.php");
// The name we send to initiate the LMTP dialog
// The email as we send the email in the LMTP dialog
$from= "damian@cnba.uba.ar";
// The email to send the email in the LMTP dialog
//$to="damian@fernandezsosa.com.ar";
$to= "damian@1aaafernandezsosa.com.ar";
// The email text (RFC822 format)
$email= "From:damian@cnba.uba.ar\r\nTo:damian@cnba.uba.ar\r\nDate: Wed, 12 Feb 2004 21:07:35 -300\r\nSubject: testing LMTP\r\n\r\nthis is a test email\r\n";
// We create the Net_LMTP instance
$lmtp_conn= new Net_LMTP( $host , $port , $localhost);
$lmtp_conn->setDebug (true );
// Connect to the LMTP server
if (PEAR ::isError ( $error = $lmtp_conn->connect ())) {
echo "ERROR:" . $error->getMessage () . "\n";
// Authenticates against the LMTP server using PLAIN method.
if (PEAR ::isError ( $error = $lmtp_conn->auth ($user,$pwd,'PLAIN'))) {
echo "ERROR:" . $error->getMessage () . "\n";
// Send the MAIL FROM: LMTP command
if (PEAR ::isError ( $error = $lmtp_conn->mailFrom ($from))) {
echo "ERROR:" . $error->getMessage () . "\n";
// Send the RCPT TO: LMTP command
if (PEAR ::isError ( $error = $lmtp_conn->rcptTo ($to))) {
echo "ERROR:" . $error->getMessage () . "\n";
// Send the DATA: LMTP command (we send the email RFC822 encoded)
if (PEAR ::isError ( $error = $lmtp_conn->data ($email))) {
echo "ERROR:" . $error->getMessage () . "\n";
// now the email was accepted by the LMTP server, so we close
// Send the QUIT LMTP command and disconnect from the LMTP server
if (PEAR ::isError ( $error = $lmtp_conn->disconnect ())) {
echo "ERROR:" . $error->getMessage () . "\n";
Documentation generated on Mon, 11 Mar 2019 15:45:26 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|