File: smtp_error.phpt

package info (click to toggle)
php-mail 1.1.14-1%2Blenny1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 132 kB
  • ctags: 219
  • sloc: php: 759; xml: 201; makefile: 56
file content (26 lines) | stat: -rw-r--r-- 711 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
--TEST--
Mail: SMTP Error Reporting
--SKIPIF--
<?php

require_once 'PEAR/Registry.php';
$registry = &new PEAR_Registry();

if (!$registry->packageExists('Net_SMTP')) die("skip\n");
--FILE--
<?php
require_once 'Mail.php';

/* Reference a bogus SMTP server address to guarantee a connection failure. */
$params = array('host' => 'bogus.host.tld');

/* Create our SMTP-based mailer object. */
$mailer = &Mail::factory('smtp', $params);

/* Attempt to send an empty message in order to trigger an error. */
if (PEAR::isError($e = $mailer->send(array(), array(), ''))) {
    die($e->getMessage() . "\n");
}

--EXPECT--
Failed to connect to bogus.host.tld:25 [SMTP: Failed to connect socket:  (code: -1, response: )]