r1467: Adding a mailtest script for people who are having problems receiving emails...
[bugdar.git] / docs / mailtest.php
1 <?php
2 /*=====================================================================*\
3 || ###################################################################
4 || # Bugdar [#]version[#]
5 || # Copyright ©2002-[#]year[#] 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 [#]gpl[#] 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($bugsys->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 $mail->setFromName('Bugdar Mailing Test');
74 $mail->setSubject('Email Tests');
75
76 // normal Bugdar mailing
77 $mail->setBodyText(sprintf($text, 1, 'sending with the Bugdar-configured address'));
78 $mail->send($bugsys->in['receive']);
79
80 // mail from the alternate address
81 $mail->setBodyText(sprintf($text, 2, 'sending from the address you specified that exists on the mail server'));
82 $mail->setFromAddress($bugsys->in['sender']);
83 $mail->send($bugsys->in['receive']);
84
85 // mail from self
86 $mail->setBodyText(sprintf($text, 3, 'sending from the receiving address'));
87 $mail->setFromAddress($bugsys->in['receive']);
88 $mail->send($bugsys->in['receive']);
89
90 // mail from non-existent
91 $mail->setBodyText(sprintf($text, 4, 'sending from a non-existent address'));
92 $mail->setFromAddress('bugdar-mail-test@bluestatic.org');
93 $mail->send($bugsys->in['receive']);
94
95 ?>
96
97 <h2>Complete</h2>
98 <p>All the test emails were sent to <em><?= $bugsys->in['receive'] ?></em>. Please check that you received all 4 tests.</p>
99
100 <?php
101 }
102
103 ?>
104
105 <hr />
106
107 <h2>Variables</h2>
108 <p>
109 <div>PHP: <?= phpversion() ?></div>
110 <div>Mail Test: $Revision$</div>
111 <div>Sendmail (From): "<?= ini_get('sendmail_from') ?>"</div>
112 <div>Sendmail (Path): "<?= ini_get('sendmail_path') ?>"</div>
113 </p>
114
115 </body>
116 </html>
117 <?php
118
119 /*=====================================================================*\
120 || ###################################################################
121 || # $HeadURL$
122 || # $Id$
123 || ###################################################################
124 \*=====================================================================*/
125 ?>