PHP 8.3.31
Preview: smtp_error.phpt Size: 720 B
/proc/thread-self/root/opt/cloudlinux/alt-php51/root/usr/share/pear/test/Mail/tests/smtp_error.phpt

--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. */
$e = $mailer->send(array(), array(), '');
if (is_a($e, 'PEAR_Error')) {
    die($e->getMessage() . "\n");
}

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

Directory Contents

Dirs: 0 × Files: 6

Name Size Perms Modified Actions
1001 B lrw-r--r-- 2021-12-02 08:02:33
Edit Download
1.20 KB lrw-r--r-- 2021-12-02 08:02:33
Edit Download
651 B lrw-r--r-- 2021-12-02 08:02:33
Edit Download
2.78 KB lrw-r--r-- 2021-12-02 08:02:33
Edit Download
720 B lrw-r--r-- 2021-12-02 08:02:33
Edit Download
640 B lrw-r--r-- 2021-12-02 08:02:33
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).