This commit has been accessed 597 times via Git panel.
commit 2075572dcf81dcf2a0411300bc08c674c04450d7
tree 3529bdf7f72325ba1b4f49069539cacbfccbdee5
parent 3bc07d4baea15a4c3b1bd885e68f674c155c4b24
author Engels Antonio <engels@majcms.org> 1298969704 +0800
committer Engels Antonio <engels@majcms.org> 1298969704 +0800
Add aliases selection in From:
diff --git a/send.php b/send.php
index e41af5d..e48ea54 100644
--- a/send.php
+++ b/send.php
@@ -85,6 +85,28 @@ if (isset($_POST['msg']) and !empty($_POST['msg']) and is_numeric($_POST['msg'])
$reply_subject = htmlentities($reply_subject,ENT_QUOTES);
$reply_cc = htmlentities($reply_cc,ENT_QUOTES);
+ $header_fetch = imap_fetchheader($mbox,$msgno);
+
+ $header_raw_lines = explode("\r\n",$header_fetch);
+
+ foreach ($header_raw_lines as $header_raw_line) {
+
+ if (strstr($header_raw_line,"X-Original-To:")) {
+
+ $header_tos[] = str_replace("X-Original-To: ","",$header_raw_line);
+ }
+/*
+ if (strstr($header_raw_line,"Delivered-To:")) {
+
+ $header_tos[] = str_replace("Delivered-To: ","",$header_raw_line);
+ }
+*/
+ }
+
+ $header_tos = array_values(array_unique($header_tos));
+
+ $send_alias_query = mysql_query("select id from aliases where alias='{$_SESSION['logged_uid']}' order by domain");
+
echo "<title>Kartero - $folder - $reply_subject</title>";
echo "<table border=\"0\" cellspacing=\"0\" callpadding=\"0\" width=\"800\"><tr><td valign=\"top\">";
@@ -98,11 +120,39 @@ if (isset($_POST['msg']) and !empty($_POST['msg']) and is_numeric($_POST['msg'])
echo "<input type=\"hidden\" name=\"ack\" value=\"1\">";
}
- echo "<tr><td width=\"50\"><b>From:</b></td><td rowspan=\"7\" width=\"5\"></td><td><input class=\"input\" type=\"text\" name=\"reply_from\" value=\"$reply_from\" readonly></td></tr>";
- echo "<tr><td><b>To:</b></td><td><input class=\"input\" type=\"text\" name=\"reply_to\" value=\"$reply_to\"></td></tr>";
+ echo "<tr><td width=\"50\"><b>From:</b></td><td rowspan=\"7\" width=\"5\"></td><td>";
+
+ if (mysql_num_rows($send_alias_query) > 0) {
+
+ echo "<select class=\"input\" name=\"reply_from\">";
+ echo "<option>$reply_from</option>";
+
+ while ($row = mysql_fetch_assoc($send_alias_query)) {
+
+ echo "<option";
+
+ if ($row[id] == $header_tos[0]) {
+ echo " selected";
+ }
+
+ echo ">\"$usr_name\" <$row[id]>";
+ echo "</option>";
+ }
+
+ echo "</select>";
+ }
+ else {
+ echo "<input class=\"input\" type=\"text\" name=\"reply_from\" value=\"$reply_from\" readonly>";
+ }
+
+ echo "</td></tr>";
+
+ mysql_free_result($send_alias_query);
+
+ echo "<tr><td><b>To:</b></td><td><input class=\"input\" type=\"text\" name=\"reply_to\" value=\"$reply_to\" required></td></tr>";
echo "<tr><td><b>Cc:</b></td><td><input class=\"input\" type=\"text\" name=\"reply_cc\" value=\"$reply_cc\"></td></tr>";
echo "<tr><td><b>Bcc:</b></td><td><input class=\"input\" type=\"text\" name=\"reply_bcc\"></td></tr>";
- echo "<tr><td><b>Subject:</b></td><td><input class=\"input\" type=\"text\" name=\"reply_subj\" value=\"$reply_subject\"></td></tr>";
+ echo "<tr><td><b>Subject:</b></td><td><input class=\"input\" type=\"text\" name=\"reply_subj\" value=\"$reply_subject\" required></td></tr>";
echo "<tr><td></td><td><textarea class=\"input\" name=\"reply_body\" rows=\"$reply_quote_rows\">";
tree 3529bdf7f72325ba1b4f49069539cacbfccbdee5
parent 3bc07d4baea15a4c3b1bd885e68f674c155c4b24
author Engels Antonio <engels@majcms.org> 1298969704 +0800
committer Engels Antonio <engels@majcms.org> 1298969704 +0800
Add aliases selection in From:
diff --git a/send.php b/send.php
index e41af5d..e48ea54 100644
--- a/send.php
+++ b/send.php
@@ -85,6 +85,28 @@ if (isset($_POST['msg']) and !empty($_POST['msg']) and is_numeric($_POST['msg'])
$reply_subject = htmlentities($reply_subject,ENT_QUOTES);
$reply_cc = htmlentities($reply_cc,ENT_QUOTES);
+ $header_fetch = imap_fetchheader($mbox,$msgno);
+
+ $header_raw_lines = explode("\r\n",$header_fetch);
+
+ foreach ($header_raw_lines as $header_raw_line) {
+
+ if (strstr($header_raw_line,"X-Original-To:")) {
+
+ $header_tos[] = str_replace("X-Original-To: ","",$header_raw_line);
+ }
+/*
+ if (strstr($header_raw_line,"Delivered-To:")) {
+
+ $header_tos[] = str_replace("Delivered-To: ","",$header_raw_line);
+ }
+*/
+ }
+
+ $header_tos = array_values(array_unique($header_tos));
+
+ $send_alias_query = mysql_query("select id from aliases where alias='{$_SESSION['logged_uid']}' order by domain");
+
echo "<title>Kartero - $folder - $reply_subject</title>";
echo "<table border=\"0\" cellspacing=\"0\" callpadding=\"0\" width=\"800\"><tr><td valign=\"top\">";
@@ -98,11 +120,39 @@ if (isset($_POST['msg']) and !empty($_POST['msg']) and is_numeric($_POST['msg'])
echo "<input type=\"hidden\" name=\"ack\" value=\"1\">";
}
- echo "<tr><td width=\"50\"><b>From:</b></td><td rowspan=\"7\" width=\"5\"></td><td><input class=\"input\" type=\"text\" name=\"reply_from\" value=\"$reply_from\" readonly></td></tr>";
- echo "<tr><td><b>To:</b></td><td><input class=\"input\" type=\"text\" name=\"reply_to\" value=\"$reply_to\"></td></tr>";
+ echo "<tr><td width=\"50\"><b>From:</b></td><td rowspan=\"7\" width=\"5\"></td><td>";
+
+ if (mysql_num_rows($send_alias_query) > 0) {
+
+ echo "<select class=\"input\" name=\"reply_from\">";
+ echo "<option>$reply_from</option>";
+
+ while ($row = mysql_fetch_assoc($send_alias_query)) {
+
+ echo "<option";
+
+ if ($row[id] == $header_tos[0]) {
+ echo " selected";
+ }
+
+ echo ">\"$usr_name\" <$row[id]>";
+ echo "</option>";
+ }
+
+ echo "</select>";
+ }
+ else {
+ echo "<input class=\"input\" type=\"text\" name=\"reply_from\" value=\"$reply_from\" readonly>";
+ }
+
+ echo "</td></tr>";
+
+ mysql_free_result($send_alias_query);
+
+ echo "<tr><td><b>To:</b></td><td><input class=\"input\" type=\"text\" name=\"reply_to\" value=\"$reply_to\" required></td></tr>";
echo "<tr><td><b>Cc:</b></td><td><input class=\"input\" type=\"text\" name=\"reply_cc\" value=\"$reply_cc\"></td></tr>";
echo "<tr><td><b>Bcc:</b></td><td><input class=\"input\" type=\"text\" name=\"reply_bcc\"></td></tr>";
- echo "<tr><td><b>Subject:</b></td><td><input class=\"input\" type=\"text\" name=\"reply_subj\" value=\"$reply_subject\"></td></tr>";
+ echo "<tr><td><b>Subject:</b></td><td><input class=\"input\" type=\"text\" name=\"reply_subj\" value=\"$reply_subject\" required></td></tr>";
echo "<tr><td></td><td><textarea class=\"input\" name=\"reply_body\" rows=\"$reply_quote_rows\">";