2 Net_SMTP: Basic Functionality
4 <?php if (!@include('config.php')) die("skip\n");
8 require_once 'Net/SMTP.php';
9 require_once 'config.php';
11 if (! ($smtp = new Net_SMTP(TEST_HOSTNAME, TEST_PORT, TEST_LOCALHOST))) {
12 die("Unable to instantiate Net_SMTP object\n");
15 if (PEAR::isError($e = $smtp->connect())) {
16 die($e->getMessage() . "\n");
19 if (PEAR::isError($e = $smtp->auth(TEST_AUTH_USER, TEST_AUTH_PASS))) {
20 die("Authentication failure\n");
23 if (PEAR::isError($smtp->mailFrom(TEST_FROM))) {
24 die('Unable to set sender to <' . TEST_FROM . ">\n");
27 if (PEAR::isError($res = $smtp->rcptTo(TEST_TO))) {
28 die('Unable to add recipient <' . TEST_TO . '>: ' .
29 $res->getMessage() . "\n");
32 $headers = 'Subject: ' . TEST_SUBJECT;
33 if (PEAR::isError($smtp->data(TEST_BODY, $headers))) {
34 die("Unable to send data\n");