RoundCube already uses 'Disposition-Notification-To' / 'Return-Receipt-To' in
message headers
for sender notification, it's the most common type used in MUA's.

Some MTA doesn't support DSN as far I know, like Exim. Another type of return
receipt option in compose window can also confuse the users, I do not think it's a
good idea to implement
in RC...

Have you considered it as a plugin? Please see http://trac.roundcube.net/wiki/Doc_Plugins

--
Victor Benincasa
http://netbit.com.br

On Thu, Sep 17, 2009 at 9:41 PM, Francisco Miralha da Silveira <fms@gramadosite.com.br> wrote:
Hi.

This is my first contact on this list and I would like to share with you
this new "feature" :-)

I would like to suggest the "Confirm-Delivery" functionality to Compose
window.

Scenario:
You want to send an e-mail and you need a way to confirm that your
MAILSERVER delivered it successfull to the DESTINATION MAILSERVER.

Many MTAs implement "Succesfull Delivery Report" (POSTFIX for example).

All you (the client) need to do is:
RCPT-TO: xxx@yyy.com NOTIFY=SUCCESS

To make it work on RC, I did this:

1) on COMPOSE NEW MESSAGE screen, add a checkBox:
[  ] Confirm Delivery

in skins\default\templates\compose.html:
---------
    <td id="delivery-selector">
     <roundcube:object name="deliveryCheckBox" form="form"
id="rcmcomposedelivery" />&nbsp;<label
for="rcmcomposedelivery"><roundcube:label name="confirmdelivery" /></label>
   </td>
---------

in program\localization\en_US\labels.inc:
---------
...
$labels['confirmdelivery'] = 'Confirm delivery';
...
---------

in skins\default\mail.css:
---------
#priority-selector,
#receipt-selector,
#delivery-selector
{
 padding-left: 30px;
 white-space: nowrap;
}
---------

in program\steps\mail\compose.inc:
---------
function rcmail_delivery_checkbox($attrib)
{
 global $MESSAGE, $compose_mode;

 list($form_start, $form_end) = get_form_tags($attrib);
 unset($attrib['form']);

 if (!isset($attrib['id']))
   $attrib['id'] = 'delivery';

 $attrib['name'] = '_delivery';
 $attrib['value'] = '1';
 $checkdelivery = new html_checkbox($attrib);

 $out = $form_start ? "$form_start\n" : '';
 $out .= $checkdelivery->show(in_array($compose_mode,
array(RCUBE_COMPOSE_DRAFT, RCUBE_COMPOSE_EDIT))
       && $MESSAGE->headers->mdn_to ? 1 : 0);
 $out .= $form_end ? "\n$form_end" : '';

 return $out;
}

$OUTPUT->add_handlers(array(
...
 'deliverycheckbox' => 'rcmail_delivery_checkbox',
...
));
---------

2) make sendmail.inc collects the user action on new checkbox:

program\steps\mail\sendmail.inc
---------
if (!empty($_POST['_delivery']))
 {
 $headers['Return-receipt-to'] = $from;
 }
---------


3) ask smtp server to generates "success delivery report" for this
message:

in program\include\rcube_smtp.php:
---------
 public function send_mail($from, $recipients, &$headers, &$body)
 {
   if (!is_object($this->conn))
     return false;
// we use this special header to know if this message requires delivery
report
       $confirm_delivery = eregi("Return-receipt-to",$headers) ?
"NOTIFY=SUCCESS":"";
       ...
       ...
       // set mail recipients
   foreach ($recipients as $recipient)
   {
// here:
     if
(PEAR::isError($this->conn->rcptTo($recipient,$confirm_delivery))) {
       ...
---------

And that's it!!

Just for info:
I used "Return-receipt-to" header because I saw it on messages sent by
PegasusMail client.
(when I check the "Confirm Delivery" checkBox in pegasus)

This software is just GREAT !!
thanks!

_______________________________________________
List info: http://lists.roundcube.net/dev/



--
Victor Benincasa