| 1 |
lars |
1 |
--TEST--
|
|
|
2 |
Mail: SMTP Error Reporting
|
|
|
3 |
--SKIPIF--
|
|
|
4 |
<?php
|
|
|
5 |
|
|
|
6 |
require_once 'PEAR/Registry.php';
|
|
|
7 |
$registry = &new PEAR_Registry();
|
|
|
8 |
|
|
|
9 |
if (!$registry->packageExists('Net_SMTP')) die("skip\n");
|
|
|
10 |
--FILE--
|
|
|
11 |
<?php
|
|
|
12 |
require_once 'Mail.php';
|
|
|
13 |
|
|
|
14 |
/* Reference a bogus SMTP server address to guarantee a connection failure. */
|
|
|
15 |
$params = array('host' => 'bogus.host.tld');
|
|
|
16 |
|
|
|
17 |
/* Create our SMTP-based mailer object. */
|
|
|
18 |
$mailer = &Mail::factory('smtp', $params);
|
|
|
19 |
|
|
|
20 |
/* Attempt to send an empty message in order to trigger an error. */
|
|
|
21 |
$e = $mailer->send(array(), array(), '');
|
|
|
22 |
if (is_a($e, 'PEAR_Error')) {
|
|
|
23 |
die($e->getMessage() . "\n");
|
|
|
24 |
}
|
|
|
25 |
|
|
|
26 |
--EXPECT--
|
|
|
27 |
Failed to connect to bogus.host.tld:25 [SMTP: Failed to connect socket: (code: -1, response: )]
|