2 /*=====================================================================*\
3 || ###################################################################
5 || # Copyright (c)2004-2008 Blue Static
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version 2 of the License.
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
22 // runs a few tests to make sure that mailing works
25 if (!file_exists('./global.php'))
29 require_once './global.php';
32 <!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
33 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
36 <meta http
-equiv
="Content-type" content
="text/html; charset=utf-8">
37 <title
>Bugdar
: Mail Test
</title
>
42 <p
>This tool will run a few email tests to make sure that emailing works
. Follow the instructions below
.</p
>
48 if (empty($input->in
['__submit__']))
52 <h2
>Email Addresses
</h2
>
53 <p
><strong
>Enter in the following email addresses
for sending
and receiving
.</strong
></p
>
55 <form action
="mailtest.php" method
="get" accept
-charset
="utf-8">
56 <p
>Email address to
<em
>receieve
</em
> all tests
: <input type
="text" name
="receive" value
="" size
="25" /></p
>
57 <p
>An email address that exists on the mail server that is
<em
>not
</em
> the one receiving the tests
: <input type
="text" name
="sender" value
="" size
="25 /"></p
>
58 <p
><input type
="submit" name
="__submit__" value
="Continue →"></p
>
65 $text = "You have successfully received test %d of 4. This tests %s.
67 ###################################################################
68 PHP: " . phpversion() . "
69 Mail Test: " . '$Revision$' . "
70 Sendmail (From): \"" . ini_get('sendmail_from
') . "\"
71 Sendmail (Path): \"" . ini_get('sendmail_path
') . "\"";
73 require_once ISSO . '/Mail
.php
';
75 $mail->setFromName('Bugdar Mailing Test
');
76 $mail->setSubject('Email Tests
');
78 if (empty($input->in['receive
']) OR empty($input->in['sender
']) OR !BSFunctions::is_valid_email($input->in['receive
']) OR !BSFunctions::is_valid_email($input->in['sender
']))
80 echo '<p style
="color: red">You did not fill in all the fields
or the email addresses are not valid
. Please
<a href
="mailtest.php">go back
</a
>.</p
>';
84 // normal Bugdar mailing
85 $mail->setBodyText(sprintf($text, 1, 'sending with the Bugdar
-configured address
'));
86 $mail->setFromAddress(bugdar::$options['webmasteremail
']);
87 $mail->send($input->in['receive
']);
89 // mail from the alternate address
90 $mail->setBodyText(sprintf($text, 2, 'sending from the address you specified that exists on the mail server
'));
91 $mail->setFromAddress($input->in['sender
']);
92 $mail->send($input->in['receive
']);
95 $mail->setBodyText(sprintf($text, 3, 'sending from the receiving address
'));
96 $mail->setFromAddress($input->in['receive
']);
97 $mail->send($input->in['receive
']);
99 // mail from non-existent
100 $mail->setBodyText(sprintf($text, 4, 'sending from a non
-existent address
'));
101 $mail->setFromAddress(preg_replace('#(.*)@(.*)#', 'bugdar-mail-test@\2', $input->in['receive']));
102 $mail->send($input->in
['receive']);
107 <p
>All the test emails were sent to
<em
><?= $input->in
['receive'] ?></em
>. Please check that you received all
4 tests
.</p
>
119 <div
>PHP
: <?php
echo phpversion(); ?></div
>
120 <div
>Mail Test
: $Revision$
</div
>
121 <div
>Sendmail (From
): "<?php echo ini_get('sendmail_from'); ?>"</div
>
122 <div
>Sendmail (Path
): "<?php echo ini_get('sendmail_path'); ?>"</div
>