<?php
require("../../phplibex.inc.php");
echo "<a href=\"".$SCRIPT_NAME."?action=php\">Send test mail with PHP-Mailer</a><br>";
echo "<a href=\"".$SCRIPT_NAME."?action=smtp\">Send test mail with SMTP-Mailer</a><br>";
echo "<a href=\"".$SCRIPT_NAME."?action=esmtp\">Send test mail with ESMTP-Mailer</a><br>";
if ( $action )
{
switch ( $action )
{
case "php":
$mailer = new phpmailer();
break;
case "smtp":
$mailer = new smtpmailer("localhost");
break;
case "esmtp":
$mailer = new smtpmailer("localhost");
break;
default:
break;
}
$mailer->mime_set_adrfrom("postmaster@localhost", "Postmaster");
$mailer->mime_set_adrto("postmaster@localhost");
$mailer->mime_set_cc("newuser@localhost");
$mailer->mime_set_bcc("newuser@localhost");
$mailer->mime_set_reference("Im the subject or the reference");
$mailer->mime_set_body("Im the body");
$mailer->mime_set_priority("1");
$mailer->mime_add_attachment("tigger.gif");
$mailer->mime_add_attachment("test.txt");
if ( $action == "smtp" || $action == "esmtp")
{
if ( $action == "esmtp" )
{
$mailer->smtp_esmtp_init( "newuser@localhost", "wampp", true );
}
if ( $mailer->smtp_do_send("text/plain") )
echo "<br><b>Everything works fine. Email is out</b>";
else
echo "<br><b>Oh Oh sorry. an error occurred</b>";
$stream = $mailer->smtp_get_stream();
echo "<br><br><b>Stream:</b><br>";
for ( $loop=0; $loop <= sizeof($stream); $loop++ )
{
$data = htmlentities($stream[$loop])."<br>";
echo nl2br($data);
}
$error = $mailer->smtp_get_errorlist();
echo "<br><b>Errorlist:</b><br>";
for ( $loop=0; $loop <= sizeof($error); $loop++ )
echo $error[$loop]."<br>";
}
if ( $action == "php" )
{
if ( $mailer->php_do_send("text/plain") )
echo "<br><b>Everything works fine. Email is out</b>";
else
echo "<br><b>Oh Oh sorry. an error occurred</b>";
$error = $mailer->php_get_errorlist();
echo "<br><b>Errorlist:</b><br>";
for ( $loop=0; $loop <= sizeof($error); $loop++ )
echo $error[$loop]."<br>";
}
$mailer->mime_clear_receiverlist();
}
?>
To: newuser@localhost
Subject: Im the subject or the reference
From: postmaster@localhost
Cc: newuser@localhost
Bcc: newuser@localhost
X-Priority: 1
X-Mailer: PHP-Lib-Extreme || http:
MIME-Version: 1.0 Content-Type: multipart/mixed;
boundary=9DEF1CA5106303D80629BE16E11C3F5F
Message-Id: <XXXXXXXXXXXXXXXX>
Date: Wed, 22 Dec 2004 16:00:00 +0100 (CET)
This is a multi-part message in MIME format
--9DEF1CA5106303D80629BE16E11C3F5F
Content-Type: text/plain Content-Transfer-Encoding: 8bit
--9DEF1CA5106303D80629BE16E11C3F5F
Content-Type: image/gif; name="tigger.gif"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="tigger.gif"
--9DEF1CA5106303D80629BE16E11C3F5F
Content-Type: text/plain; name="test.txt"
Content-Transfer-Encoding: 8Bit
Content-Disposition: attachment; filename="test.txt"
--9DEF1CA5106303D80629BE16E11C3F5F--