// The username to authenticate to the LMTP server
$user="cyrus";
// The password to authenticate to the LMTP server
$pwd="password";
//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
$localhost="localhost";
// 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";
//$to="damian";
// 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";
exit();
}
// Authenticates against the LMTP server using PLAIN method.
if (PEAR::isError( $error = $lmtp_conn->auth($user,$pwd,'PLAIN'))) {
echo "ERROR:" . $error->getMessage() . "\n";
exit();
}
// Send the MAIL FROM: LMTP command
if (PEAR::isError( $error = $lmtp_conn->mailFrom($from))) {
echo "ERROR:" . $error->getMessage() . "\n";
exit();
}
// Send the RCPT TO: LMTP command
if (PEAR::isError( $error = $lmtp_conn->rcptTo($to))) {
echo "ERROR:" . $error->getMessage() . "\n";
exit();
}
// Send the DATA: LMTP command (we send the email RFC822 encoded)
if (PEAR::isError( $error = $lmtp_conn->data($email))) {
echo "ERROR:" . $error->getMessage() . "\n";
exit();
}
// now the email was accepted by the LMTP server, so we close
// the connection
// Send the QUIT LMTP command and disconnect from the LMTP server
if (PEAR::isError( $error = $lmtp_conn->disconnect())) {