1<?php
2/**
3 * mailout.php
4 *
5 * Copyright (c) 1999-2021 The SquirrelMail Project Team
6 * Licensed under the GNU GPL. For full terms see the file COPYING.
7 *
8 * $Id: mailout.php 14885 2021-02-05 19:19:32Z pdontthink $
9 * @package plugins
10 * @subpackage listcommands
11 */
12
13define('SM_PATH','../../');
14
15/* SquirrelMail required files. */
16require_once(SM_PATH . 'include/validate.php');
17include_once(SM_PATH . 'functions/page_header.php');
18include_once(SM_PATH . 'include/load_prefs.php');
19include_once(SM_PATH . 'functions/html.php');
20require_once(SM_PATH . 'functions/identity.php');
21
22displayPageHeader($color, null);
23
24/* get globals */
25sqgetGlobalVar('mailbox', $mailbox, SQ_GET);
26sqgetGlobalVar('send_to', $send_to, SQ_GET);
27sqgetGlobalVar('subject', $subject, SQ_GET);
28sqgetGlobalVar('body',    $body,    SQ_GET);
29sqgetGlobalVar('action',  $action,  SQ_GET);
30sqgetGlobalVar('identity',  $identity,  SQ_GET);
31
32switch ( $action ) {
33case 'help':
34    $out_string = _("This will send a message to %s requesting help for this list. You will receive an emailed response at the address below.");
35    break;
36case 'subscribe':
37    $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.");
38    break;
39case 'unsubscribe':
40    $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.");
41    break;
42default:
43    error_box(sprintf(_("Unknown action: %s"),sm_encode_html_special_chars($action)), $color);
44    exit;
45}
46
47echo html_tag('p', '', 'left' ) .
48html_tag( 'table', '', 'center', $color[0], 'border="0" width="75%"' ) . "\n" .
49    html_tag( 'tr',
50        html_tag( 'th', _("Mailinglist") . ' ' . _($action), '', $color[9] )
51    ) .
52    html_tag( 'tr' ) .
53    html_tag( 'td', '', 'left' );
54
55
56printf( $out_string, sm_encode_html_special_chars($send_to) );
57
58echo '<form method="post" action="../../src/compose.php">'.
59     '<input type="hidden" name="smtoken" value="' . sm_generate_security_token() . '" />';
60
61$idents = get_identities();
62
63echo html_tag('p', '', 'center' ) . _("From:") . ' ';
64
65if (count($idents) > 1) {
66    echo '<select name="identity">';
67    foreach($idents as $nr=>$data) {
68        echo '<option '
69           . ($identity == $nr ? ' selected="selected" ' : '')
70           . 'value="' . $nr . '">'
71           . sm_encode_html_special_chars(
72                $data['full_name'].' <'.
73                $data['email_address'] . ">\n");
74    }
75    echo '</select>' . "\n" ;
76} else {
77    echo sm_encode_html_special_chars('"'.$idents[0]['full_name'].'" <'.$idents[0]['email_address'].'>');
78}
79
80echo '<br /><br />'
81. '<input type="hidden" name="send_to" value="' . sm_encode_html_special_chars($send_to) . '">'
82. '<input type="hidden" name="subject" value="' . sm_encode_html_special_chars($subject) . '">'
83. '<input type="hidden" name="body" value="' . sm_encode_html_special_chars($body) . '">'
84. '<input type="hidden" name="mailbox" value="' . sm_encode_html_special_chars($mailbox) . '">'
85. '<input type="submit" name="send" value="' . _("Send Mail") . '"><br /><br />'
86. '</form></td></tr></table></body></html>';
87
88