Hi There! :D
We successfully added the "Confirm-Delivery" functionality on ROUNDCUBE running on our server, and I would like to suggest RC team to incorporate it.
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).
To ask a MAILSERVER to generate this report for you, your smtp CLIENT must say to the smtp server:
RCPT-TO: [email protected] NOTIFY=SUCCESSTo make it work on RC, we did this:
1) on COMPOSE NEW MESSAGE screen, we add a checkBox: [ ] Confirm Delivery
in
skins\default\templates\compose.html, we add:
<td id="delivery-selector">
<roundcube:object name="deliveryCheckBox" form="form" id="rcmcomposedelivery" /> <label for="rcmcomposedelivery"><roundcube:label name="confirmdelivery" /></label>
</td>
in
program\localization\en_US\labels.inc:
...
$labels['confirmdelivery'] = 'Confirm delivery';
...
and add "#delivery-selector" on
skins\default\mail.css:
#priority-selector,
#receipt-selector,
#delivery-selector
{
padding-left: 30px;
white-space: nowrap;
}
in
program\steps\mail\compose.inc:
// we add this new function:
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(
...
// we add this line:
'deliverycheckbox' => 'rcmail_delivery_checkbox',
...
));
2) make sendmail.inc collects the user desire for this message:program\steps\mail\sendmail.inc
if (!empty($_POST['_delivery']))
{
$headers['Return-receipt-to'] = $from;
}
3) we want tell smtp_server to generate 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 add this:
$confirm_delivery = eregi("Return-receipt-to",$headers) ? "NOTIFY=SUCCESS":"";
...
...
// we add the $confirm_delivery parameter on rcptTo call
// set mail recipients
foreach ($recipients as $recipient)
{
// here:
if (PEAR::isError($this->conn->rcptTo($recipient,$confirm_delivery))) {
...
And that's it!!
Just for info:
We used "Return-receipt-to" header because we saw it on messages sent by PegasusMail client.
(when we check the "Confirm Delivery" checkBox in that message)
I hope ROUNDCUBE team accept my suggestion and include this great feature in RC.
Best regards
That's a great contribution ... Goto to devs list. There you have the chance to discuss it with RoundCube devs. This is a user2user support forum. May be your improvement will reach some plugin coders. If you are conviced it should be included into default RoundCube please goto to the list.
humm ok... Thanks Rosali! :)