]> src.bluestatic.org Git - bugdar.git/blob - docs/mailtest.php
Fix entity typos
[bugdar.git] / docs / mailtest.php
1 <?php
2 /*=====================================================================*\
3 || ###################################################################
4 || # Bugdar
5 || # Copyright (c)2004-2008 Blue Static
6 || #
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.
10 || #
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
14 || # more details.
15 || #
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 \*=====================================================================*/
21
22 // runs a few tests to make sure that mailing works
23 // SVN $Id$
24
25 if (!file_exists('./global.php'))
26 {
27 chdir('../');
28 }
29 require_once './global.php';
30
31 ?>
32 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
33 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
34 <html>
35 <head>
36 <meta http-equiv="Content-type" content="text/html; charset=utf-8">
37 <title>Bugdar: Mail Test</title>
38 </head>
39 <body>
40
41 <h1>Mail Test</h1>
42 <p>This tool will run a few email tests to make sure that emailing works. Follow the instructions below.</p>
43
44 <hr />
45
46 <?php
47
48 if (empty($input->in['__submit__']))
49 {
50 ?>
51
52 <h2>Email Addresses</h2>
53 <p><strong>Enter in the following email addresses for sending and receiving.</strong></p>
54
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 &rarr;"></p>
59 </form>
60
61 <?php
62 }
63 else
64 {
65 $text = "You have successfully received test %d of 4. This tests %s.
66
67 ###################################################################
68 PHP: " . phpversion() . "
69 Mail Test: " . '$Revision$' . "
70 Sendmail (From): \"" . ini_get('sendmail_from') . "\"
71 Sendmail (Path): \"" . ini_get('sendmail_path') . "\"";
72
73 require_once ISSO . '/Mail.php';
74 $mail = new BSMail();
75 $mail->setFromName('Bugdar Mailing Test');
76 $mail->setSubject('Email Tests');
77
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']))
79 {
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>';
81 }
82 else
83 {
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']);
88
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']);
93
94 // mail from self
95 $mail->setBodyText(sprintf($text, 3, 'sending from the receiving address'));
96 $mail->setFromAddress($input->in['receive']);
97 $mail->send($input->in['receive']);
98
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']);
103
104 ?>
105
106 <h2>Complete</h2>
107 <p>All the test emails were sent to <em><?= $input->in['receive'] ?></em>. Please check that you received all 4 tests.</p>
108
109 <?php
110 }
111 }
112
113 ?>
114
115 <hr />
116
117 <h2>Variables</h2>
118 <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>
123 </p>
124
125 </body>
126 </html>
127 <?php
128
129 ?>