[imp] Delivery Confirmation / Read Receipt Patch

rmalloy at meridianschools.org rmalloy at meridianschools.org
Wed Jan 29 23:59:22 PST 2003


The patch below separates the delivery confirmation conand read receipt 
requests in the compose window. I also added a section to preferences to 
specify default behavior. Note, the Honor read receipts functionality isn't 
complete yet. 

I think the compose.inc could probably be done cleaner. If anyone has any 
ideas, please post.

--- imp/compose.php	Wed Jan 29 23:33:31 2003
+++ imp.hacked/compose.php	Wed Jan 29 22:30:51 2003
@@ -629,9 +629,15 @@
 
         $msg_headers->addHeader('Date', date('r'));
 
+
+        if ($conf['compose']['allow_receipts'] &&
+            Horde::getFormData('request_read_receipt')) {
+            $msg_headers->addReadReceiptHeaders($barefrom);
+        }
+
         if ($conf['compose']['allow_receipts'] &&
-            Horde::getFormData('request_return_receipt')) {
-            $msg_headers->addReturnReceiptHeaders($barefrom);
+            Horde::getFormData('request_delivery_confirmation')) {
+            $msg_headers->addDeliveryReceiptHeaders($barefrom);
         }
 
         $msg_headers->addHeader('From', $from);
--- imp/config/conf.xml	Wed Jan 29 23:33:31 2003
+++ imp.hacked/config/conf.xml	Wed Jan 29 22:30:51 2003
@@ -33,6 +33,7 @@
    <configstring name="alternate_login" desc="If this is not false, it is 
assumed to be the URL of an alternate login screen which will be used in place 
of IMP's default one.">false</configstring>
    <configstring name="redirect_on_logout" desc="If this is not false, it is 
assumed to be the URL of an alternate logout page which users will be sent to 
when they log out.">false</configstring>
    <configboolean name="select_sentmail_folder" desc="If this is true, then 
users will be given a drop down menu in the compose window allowing them to 
choose which folder to save their sent messages to. If this is false, then 
messages will be saved to the folder defined in their 
preferences.">false</configboolean>
+   <configboolean name="allow_honor_read_receipts" desc="If this is true, 
then users will be able to honor requests for read receipts based on their 
preferences.">false</configboolean>
  </configsection>
 
  <configsection name="server">
--- imp/lib/Headers.php	Wed Jan 29 23:33:31 2003
+++ imp.hacked/lib/Headers.php	Wed Jan 29 22:30:51 2003
@@ -428,21 +428,18 @@
     }
 
     /**
-     * Generate return receipt headers.
+     * Generate read receipt headers.
      *
      * @access public
      *
      * @param string $to  The address the notification should be mailed to.
      */
-    function addReturnReceiptHeaders($to)
+    function addReadReceiptHeaders($to)
     {
         /* This is the RFC 2298 way of requesting a receipt. */
         $this->addHeader('Disposition-Notification-To', $to);
 
-        /* This is old sendmail (pre-8.7) behavior. */
-        $this->addHeader('Return-Receipt-To', $to);
-
-        /* Unknown. */
+        /* For Pegasus mail. */
         $this->addHeader('X-Confirm-Reading-To', $to);
 
         /* For certain Pegasus mail installations. */
@@ -450,6 +447,19 @@
     }
 
     /**
+     * Generate delivery receipt headers.
+     *
+     * @access public
+     *
+     * @param string $to  The address the notification should be mailed to.
+     */
+    function addDeliveryReceiptHeaders($to)
+    {
+        /* This is old sendmail (pre-8.7) behavior. */
+        $this->addHeader('Return-Receipt-To', $to);
+    }
+
+    /**
      * Generate the user agent description header.
      *
      * @access public
--- imp/templates/compose/compose.inc	Wed Jan 29 23:33:32 2003
+++ imp.hacked/templates/compose/compose.inc	Wed Jan 29 22:30:51 2003
@@ -371,8 +371,12 @@
     <td valign="bottom" class="item" align="left">
         <table border="0" cellspacing="0" cellpadding="0">
         <tr>
-            <td><input id="rrr" type="checkbox" 
name="request_return_receipt"<?php echo Horde::getFormData
('request_return_receipt') == 'on' ? ' checked="checked"' : '' ?> /></td>
-            <td><label for="rrr"><?php echo _("Request a Return Receipt") ?
></label></td>
+            <td><input id="rrr" type="checkbox" name="request_read_receipt"<?
php if($prefs->getValue('disposition_request_read') == "ask") echo 
Horde::getFormData('request_read_receipt') == 'on' ? ' 
checked="checked"' : ''; elseif($prefs->getValue('disposition_request_read') 
== "always") echo " checked"; elseif($prefs->getValue
('disposition_request_read') == "never") echo " disabled" ?> /></td>
+            <td><label for="rrr"><?php echo _("Request a Read Receipt") ?
></label></td>
+        </tr>
+        <tr>
+            <td><input id="rdr" type="checkbox" 
name="request_delivery_confirmation"<?php if($prefs->getValue
('disposition_delivery_read') == "ask") echo Horde::getFormData
('request_delivery_confirmation') == 'on' ? ' checked="checked"' : ''; elseif
($prefs->getValue('disposition_request_delivery') == "always") echo " 
checked"; elseif($prefs->getValue('disposition_request_delivery') == "never") 
echo " disabled" ?> /></td>
+            <td><label for="rdr"><?php echo _("Request Delivery 
Confirmation") ?></label></td>
         </tr>
         </table>
     </td>
--- imp/config/prefs.php.dist	Wed Jan 29 23:33:31 2003
+++ imp.hacked/config/prefs.php.dist	Wed Jan 29 23:30:05 2003
@@ -51,6 +51,14 @@
         'members' => array
('preview_enabled', 'preview_maxlen', 'preview_strip_nl', 'preview_show_unread'
));
 }
 
+if (array_key_exists('user',$GLOBALS['conf']) && $GLOBALS['conf']['user']
['allow_honor_read_receipts'] || $GLOBALS['conf']['compose']
['allow_receipts']) {
+    $prefGroups['honor_read_receipts'] = array(
+        'column' => _("Your Information"),
+        'label' => _("Disposition Notifications"),
+        'desc' => _("Configure options for message disposition 
notifications"),
+        'members' => array
('disposition_honor','disposition_request_read','disposition_request_delivery')
);
+}
+
 $prefGroups['filters'] = array(
     'column' => _("Mail Management"),
     'label' => _("Filters"),
@@ -348,6 +356,43 @@
 
 // End Message Preview
 
+// Disposition Notifications Preferences
+if($GLOBALS['conf']['user']['allow_honor_read_receipts']) {
+$_prefs['disposition_honor'] = array(
+    'value' => 'never',
+    'locked' => false,
+    'shared' => false,
+    'type' => 'enum',
+    'enum' => array('never' => _("Never"),
+                    'ask' => _("Ask"),
+                    'always' => _("Always")),
+    'desc' => _("Honor Requests for read receipts?")
+);
+}
+if($GLOBALS['conf']['compose']['allow_receipts']) {
+$_prefs['disposition_request_read'] = array(
+    'value' => 'ask',
+    'locked' => false,
+    'shared' => false,
+    'type' => 'enum',
+    'enum' => array('never' => _("Never"),
+                    'ask' => _("Ask"),
+                    'always' => _("Always")),
+    'desc' => _("Request read receipts?")
+);
+$_prefs['disposition_request_delivery'] = array(
+    'value' => 'ask',
+    'locked' => false,
+    'shared' => false,
+    'type' => 'enum',
+    'enum' => array('never' => _("Never"),
+                    'ask' => _("Ask"),
+                    'always' => _("Always")),
+    'desc' => _("Request delivery confirmation?")
+);
+}
+// End Disposition Notifications
+
 // Filter preferences
 
 // Change this if you want to customize how filters.php works.
--- imp.orig/locale/en_US/help.xml	Wed Jan 29 21:15:22 2003
+++ imp/locale/en_US/help.xml	Wed Jan 29 23:50:37 2003
@@ -71,6 +71,12 @@
     <para>
     Activate the check-button next to "Save copy" to save a copy of this 
message in your "Sent Mail" folder. Save copies of important emails you send 
so that you have something to refer back to later and to keep an accurate 
record of what was said. We do not recommend you save every email since then 
your disk storage quota will be used up quickly (especially when you send 
attachments) and your mailbox will be full and unable to receive new incoming 
email. You can, however, turn this feature 'on' as your     </para>
+    <para>
+    "Request a Read Receipt" sends a request to the recipients of this 
message to notify you when this message is opened by the recipients. Not all 
clients support / honor this.
+    </para>
+    <para>
+    "Request Delivery Confirmation" sends a request to the recipient's e-mail 
server to notify you when it has delivered the message to the recipient's 
mailbox. It doesn't mean the message has been seen, just that it's sitting in 
a mailbox somewhere. Not all mail servers support this. 
+    </para>
 </entry>
 
 <entry id="compose-attach">

-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/


More information about the imp mailing list