summaryrefslogtreecommitdiff
path: root/program/steps/mail/show.inc
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2010-09-29 12:56:10 +0000
committeralecpl <alec@alec.pl>2010-09-29 12:56:10 +0000
commita99968259d001ebc8bd98f0f2a0aa544ed4740e8 (patch)
tree919414917e3963878df8323820eb4693b57cb27b /program/steps/mail/show.inc
parente99991996dbb9e7b0b0ff6cfa94dc0fb2522eb66 (diff)
- Add option to automatically send read notifications for known senders (1485883)
Diffstat (limited to 'program/steps/mail/show.inc')
-rw-r--r--program/steps/mail/show.inc30
1 files changed, 22 insertions, 8 deletions
diff --git a/program/steps/mail/show.inc b/program/steps/mail/show.inc
index 382733f5e..bc208ab7c 100644
--- a/program/steps/mail/show.inc
+++ b/program/steps/mail/show.inc
@@ -72,17 +72,19 @@ if ($uid = get_input_value('_uid', RCUBE_INPUT_GET)) {
$mbox_name != $CONFIG['drafts_mbox'] &&
$mbox_name != $CONFIG['sent_mbox'])
{
- if (intval($CONFIG['mdn_requests']) === 1)
- {
- if (rcmail_send_mdn($MESSAGE->uid, $smtp_error))
+ $mdn_cfg = intval($CONFIG['mdn_requests']);
+
+ if ($mdn_cfg == 1 || ($mdn_cfg == 3 && rcmail_contact_exists($MESSAGE->sender['mailto']))) {
+ // Send MDN
+ if (rcmail_send_mdn($MESSAGE, $smtp_error))
$OUTPUT->show_message('receiptsent', 'confirmation');
else if ($smtp_error)
$OUTPUT->show_message($smtp_error['label'], 'error', $smtp_error['vars']);
else
$OUTPUT->show_message('errorsendingreceipt', 'error');
}
- else if (empty($CONFIG['mdn_requests']))
- {
+ else if ($mdn_cfg != 2) {
+ // Ask user
$OUTPUT->add_label('mdnrequest');
$OUTPUT->set_env('mdn_request', true);
}
@@ -181,8 +183,6 @@ function rcmail_message_attachments($attrib)
return $out;
}
-
-
function rcmail_remote_objects_msg($attrib)
{
global $MESSAGE, $RCMAIL;
@@ -203,6 +203,21 @@ function rcmail_remote_objects_msg($attrib)
return html::div($attrib, $msg);
}
+function rcmail_contact_exists($email)
+{
+ global $RCMAIL;
+
+ if ($email) {
+ // @TODO: search in all address books?
+ $CONTACTS = $RCMAIL->get_address_book(null, true);
+ $existing = $CONTACTS->search('email', $email, true, false);
+ if ($existing->count)
+ return true;
+ }
+
+ return false;
+}
+
$OUTPUT->add_handlers(array(
'messageattachments' => 'rcmail_message_attachments',
@@ -228,4 +243,3 @@ if ($MESSAGE && $MESSAGE->headers && !$MESSAGE->headers->seen &&
exit;
-