Skip to content

Commit

Permalink
Apply more of #4
Browse files Browse the repository at this point in the history
  • Loading branch information
CloCkWeRX committed Mar 9, 2014
1 parent 7273bec commit dc713a3
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions tests/basic.phpt
Expand Up @@ -12,24 +12,31 @@ if (! ($smtp = new Net_SMTP(TEST_HOSTNAME, TEST_PORT, TEST_LOCALHOST))) {
die("Unable to instantiate Net_SMTP object\n");
}

if (PEAR::isError($e = $smtp->connect())) {
try {
$e = $smtp->connect();
} catch (Exception $e) {
die($e->getMessage() . "\n");
}

if (PEAR::isError($e = $smtp->auth(TEST_AUTH_USER, TEST_AUTH_PASS))) {
die("Authentication failure\n");
}

if (PEAR::isError($smtp->mailFrom(TEST_FROM))) {
try {
$smtp->mailFrom(TEST_FROM);
} catch (Exception $e) {
die('Unable to set sender to <' . TEST_FROM . ">\n");
}

if (PEAR::isError($res = $smtp->rcptTo(TEST_TO))) {
die('Unable to add recipient <' . TEST_TO . '>: ' .
$res->getMessage() . "\n");
try {
$smtp->rcptTo(TEST_TO);
} catch (Exception $e) { die('Unable to add recipient <' . TEST_TO . '>: ' .
$e->getMessage() . "\n");
}

if (PEAR::isError($smtp->data('Subject: ' . TEST_SUBJECT . "\r\n\r\n" . TEST_BODY))) {
try {
$smtp->data(TEST_SUBJECT . "\r\n" . TEST_BODY);
} catch (Exception $e) {
die("Unable to send data\n");
}

Expand Down

0 comments on commit dc713a3

Please sign in to comment.