diff options
author | alecpl <alec@alec.pl> | 2010-10-07 08:52:05 +0000 |
---|---|---|
committer | alecpl <alec@alec.pl> | 2010-10-07 08:52:05 +0000 |
commit | f22ea7ba1875863890b486db3e5f448f99c1debc (patch) | |
tree | c13218570f467c72076f9e6f31c7a9d49fc783d4 /program/steps | |
parent | 9db4ca92efc620fa5d38f53557e75e9a8e345047 (diff) |
- Support SMTP Delivery Status Notifications - RFC3461 (#1486142)
Diffstat (limited to 'program/steps')
-rw-r--r-- | program/steps/mail/compose.inc | 23 | ||||
-rw-r--r-- | program/steps/mail/func.inc | 5 | ||||
-rw-r--r-- | program/steps/mail/sendmail.inc | 8 | ||||
-rw-r--r-- | program/steps/settings/func.inc | 10 | ||||
-rw-r--r-- | program/steps/settings/save_prefs.inc | 1 |
5 files changed, 44 insertions, 3 deletions
diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc index c1f491403..406033cb9 100644 --- a/program/steps/mail/compose.inc +++ b/program/steps/mail/compose.inc @@ -1174,6 +1174,28 @@ function rcmail_receipt_checkbox($attrib) } +function rcmail_dsn_checkbox($attrib) +{ + global $RCMAIL; + + list($form_start, $form_end) = get_form_tags($attrib); + unset($attrib['form']); + + if (!isset($attrib['id'])) + $attrib['id'] = 'dsn'; + + $attrib['name'] = '_dsn'; + $attrib['value'] = '1'; + $checkbox = new html_checkbox($attrib); + + $out = $form_start ? "$form_start\n" : ''; + $out .= $checkbox->show($RCMAIL->config->get('dsn_default')); + $out .= $form_end ? "\n$form_end" : ''; + + return $out; +} + + function rcmail_editor_selector($attrib) { global $CONFIG, $MESSAGE, $compose_mode; @@ -1251,6 +1273,7 @@ $OUTPUT->add_handlers(array( 'priorityselector' => 'rcmail_priority_selector', 'editorselector' => 'rcmail_editor_selector', 'receiptcheckbox' => 'rcmail_receipt_checkbox', + 'dsncheckbox' => 'rcmail_dsn_checkbox', 'storetarget' => 'rcmail_store_target_selection', )); diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc index aad127cfc..0fa22753d 100644 --- a/program/steps/mail/func.inc +++ b/program/steps/mail/func.inc @@ -1478,10 +1478,11 @@ function rcmail_compose_cleanup() * @param array $mailto Array of recipient address strings * @param array $smtp_error SMTP error array (reference) * @param string $body_file Location of file with saved message body (reference) + * @param array $smtp_opts SMTP options (e.g. DSN request) * * @return boolean Send status. */ -function rcmail_deliver_message(&$message, $from, $mailto, &$smtp_error, &$body_file) +function rcmail_deliver_message(&$message, $from, $mailto, &$smtp_error, &$body_file, $smtp_opts=null) { global $CONFIG, $RCMAIL; @@ -1525,7 +1526,7 @@ function rcmail_deliver_message(&$message, $from, $mailto, &$smtp_error, &$body_ if (!is_object($RCMAIL->smtp)) $RCMAIL->smtp_init(true); - $sent = $RCMAIL->smtp->send_mail($from, $a_recipients, $smtp_headers, $msg_body); + $sent = $RCMAIL->smtp->send_mail($from, $a_recipients, $smtp_headers, $msg_body, $smtp_opts); $smtp_response = $RCMAIL->smtp->get_response(); $smtp_error = $RCMAIL->smtp->get_error(); diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc index a9ecf2ea2..da79c2f83 100644 --- a/program/steps/mail/sendmail.inc +++ b/program/steps/mail/sendmail.inc @@ -546,7 +546,13 @@ if (!$savedraft) $OUTPUT->send('iframe'); } - $sent = rcmail_deliver_message($MAIL_MIME, $from, $mailto, $smtp_error, $mailbody_file); + // Handle Delivery Status Notification request + if (!empty($_POST['_dsn'])) { + $smtp_opts['dsn'] = true; + } + + $sent = rcmail_deliver_message($MAIL_MIME, $from, $mailto, + $smtp_error, $mailbody_file, $smtp_opts); // return to compose page if sending failed if (!$sent) diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc index a7d4c11f0..e0aa5629b 100644 --- a/program/steps/settings/func.inc +++ b/program/steps/settings/func.inc @@ -524,6 +524,16 @@ function rcmail_user_prefs($current=null) ); } + if (!isset($no_override['dsn_default'])) { + $field_id = 'rcmfd_dsn_default'; + $input_dsn = new html_checkbox(array('name' => '_dsn_default', 'id' => $field_id, 'value' => 1)); + + $blocks['main']['options']['dsn_default'] = array( + 'title' => html::label($field_id, Q(rcube_label('reqdsn'))), + 'content' => $input_dsn->show($config['dsn_default']?1:0), + ); + } + if (!isset($no_override['top_posting'])) { $field_id = 'rcmfd_top_posting'; $select_replymode = new html_select(array('name' => '_top_posting', 'id' => $field_id, 'onchange' => "\$('#rcmfd_sig_above').attr('disabled',this.selectedIndex==0)")); diff --git a/program/steps/settings/save_prefs.inc b/program/steps/settings/save_prefs.inc index ae3d6d704..63654eefc 100644 --- a/program/steps/settings/save_prefs.inc +++ b/program/steps/settings/save_prefs.inc @@ -66,6 +66,7 @@ switch ($CURR_SECTION) 'mime_param_folding' => isset($_POST['_mime_param_folding']) ? intval($_POST['_mime_param_folding']) : 0, 'force_7bit' => isset($_POST['_force_7bit']) ? TRUE : FALSE, 'mdn_default' => isset($_POST['_mdn_default']) ? TRUE : FALSE, + 'dsn_default' => isset($_POST['_dsn_default']) ? TRUE : FALSE, 'show_sig' => isset($_POST['_show_sig']) ? intval($_POST['_show_sig']) : 1, 'top_posting' => !empty($_POST['_top_posting']), 'strip_existing_sig' => isset($_POST['_strip_existing_sig']), |