LogChanges
[squirrelmail.git] / plugins / listcommands / mailout.php
1 <?php
2 /**
3 * mailout.php
4 *
5 * Copyright (c) 1999-2003 The SquirrelMail Project Team
6 * Licensed under the GNU GPL. For full terms see the file COPYING.
7 *
8 * $Id$
9 */
10
11 define('SM_PATH','../../');
12
13 /* SquirrelMail required files. */
14 require_once(SM_PATH . 'include/validate.php');
15 include_once(SM_PATH . 'functions/page_header.php');
16 include_once(SM_PATH . 'include/load_prefs.php');
17 include_once(SM_PATH . 'functions/html.php');
18
19 displayPageHeader($color, $mailbox);
20
21 /* get globals */
22 $mailbox = $_GET['mailbox'];
23 $send_to = $_GET['send_to'];
24 $subject = $_GET['subject'];
25 $body = $_GET['body'];
26 $action = $_GET['action'];
27
28 echo html_tag('p', '', 'left' ) .
29 html_tag( 'table', '', 'center', $color[0], 'border="0" width="75%"' ) . "\n" .
30 html_tag( 'tr',
31 html_tag( 'th', _("Mailinglist") . ' ' . _($action), '', $color[9] )
32 ) .
33 html_tag( 'tr' ) .
34 html_tag( 'td', '', 'left' );
35
36 switch ( $action ) {
37 case 'help':
38 $out_string = _("This will send a message to %s requesting help for this list. You will receive an emailed response at the address below.");
39 break;
40 case 'subscribe':
41 $out_string = _("This will send a message to %s requesting that you will be subscribed to this list. You will be subscribed with the address below.");
42 break;
43 case 'unsubscribe':
44 $out_string = _("This will send a message to %s requesting that you will be unsubscribed from this list. It will try to unsubscribe the adress below.");
45 }
46
47 printf( $out_string, htmlspecialchars($send_to) );
48
49 echo '<form method="post" action="../../src/compose.php">';
50
51 /*
52 * Identity support (RFC 2369 sect. B.1.)
53 *
54 * I had to copy this from compose.php because there doesn't
55 * seem to exist a function to get the identities.
56 */
57
58 $defaultmail = htmlspecialchars(getPref($data_dir, $username, 'full_name'));
59 $em = getPref($data_dir, $username, 'email_address');
60 if ($em != '') {
61 $defaultmail .= htmlspecialchars(' <' . $em . '>') . "\n";
62 }
63 echo html_tag('p', '', 'center' ) . _("From:") . ' ';
64
65 $idents = getPref($data_dir, $username, 'identities');
66 if ($idents != '' && $idents > 1) {
67 echo ' <select name="identity">' . "\n" .
68 '<option value="default">' . $defaultmail;
69 for ($i = 1; $i < $idents; $i ++) {
70 echo '<option value="' . $i . '"';
71 if (isset($identity) && $identity == $i) {
72 echo ' selected';
73 }
74 echo '>' . htmlspecialchars(getPref($data_dir, $username,
75 'full_name' . $i));
76 $em = getPref($data_dir, $username, 'email_address' . $i);
77 if ($em != '') {
78 echo htmlspecialchars(' <' . $em . '>') . "\n";
79 }
80 }
81 echo '</select>' . "\n" ;
82
83 } else {
84 echo $defaultmail;
85 }
86
87 echo '<br />'
88 . '<input type="hidden" name="send_to" value="' . htmlspecialchars($send_to) . '">'
89 . '<input type="hidden" name="subject" value="' . htmlspecialchars($subject) . '">'
90 . '<input type="hidden" name="body" value="' . htmlspecialchars($body) . '">'
91 . '<input type="hidden" name="mailbox" value="' . htmlspecialchars($mailbox) . '">'
92 . '<input type="submit" name="send" value="' . _("Send Mail") . '"><br /><br /></center>'
93 . '</form></td></tr></table></p></body></html>';
94 ?>