Changeset f22ea7b in github


Ignore:
Timestamp:
Oct 7, 2010 4:52:05 AM (3 years ago)
Author:
alecpl <alec@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
e947068
Parents:
9db4ca9
Message:
  • Support SMTP Delivery Status Notifications - RFC3461 (#1486142)
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • CHANGELOG

    r7f89041 rf22ea7b  
    2222- Make htmleditor option more consistent and add option to use HTML on reply to HTML message (#1485840) 
    2323- Use empty envelope sender address for message disposition notifications (RFC2298.3) 
     24- Support SMTP Delivery Status Notifications - RFC3461 (#1486142) 
    2425 
    2526RELEASE 0.4.2 
  • config/main.inc.php.dist

    r868deb5 rf22ea7b  
    334334// if in your system 0 quota means no limit set this option to true  
    335335$rcmail_config['quota_zero_as_unlimited'] = false; 
    336  
    337 // Behavior if a received message requests a message delivery notification (read receipt) 
    338 // 0 = ask the user, 1 = send automatically, 2 = ignore (never send or ask) 
    339 // 3 = send automatically if sender is in addressbook, otherwise ask the user 
    340 // 4 = send automatically if sender is in addressbook, otherwise ignore 
    341 $rcmail_config['mdn_requests'] = 0; 
    342336 
    343337// Make use of the built-in spell checker. It is based on GoogieSpell. 
     
    572566$rcmail_config['delete_always'] = false; 
    573567 
     568// Behavior if a received message requests a message delivery notification (read receipt) 
     569// 0 = ask the user, 1 = send automatically, 2 = ignore (never send or ask) 
     570// 3 = send automatically if sender is in addressbook, otherwise ask the user 
     571// 4 = send automatically if sender is in addressbook, otherwise ignore 
     572$rcmail_config['mdn_requests'] = 0; 
     573 
     574// Return receipt checkbox default state 
     575$rcmail_config['mdn_default'] = 0; 
     576 
     577// Delivery Status Notification checkbox default state 
     578$rcmail_config['dsn_default'] = 0; 
     579 
    574580// end of config file 
    575  
  • program/include/rcube_message.php

    r868deb5 rf22ea7b  
    400400                        $this->attachments[] = $mail_part; 
    401401                } 
    402                 // part text/[plain|html] OR message/delivery-status 
     402                // part text/[plain|html] or delivery status 
    403403                else if ((($part_mimetype == 'text/plain' || $part_mimetype == 'text/html') && $mail_part->disposition != 'attachment') || 
    404                     $part_mimetype == 'message/delivery-status' || $part_mimetype == 'message/disposition-notification' 
     404                    in_array($part_mimetype, array('message/delivery-status', 'text/rfc822-headers', 'message/disposition-notification')) 
    405405                ) { 
    406406                    // Allow plugins to handle also this part 
  • program/include/rcube_smtp.php

    r7f89041 rf22ea7b  
    154154   *               specified in the headers, for Bcc:, resending 
    155155   *               messages, etc. 
    156    * 
    157156   * @param mixed  The message headers to send with the mail 
    158157   *               Either as an associative array or a finally 
    159158   *               formatted string 
    160    * 
    161159   * @param mixed  The full text of the message body, including any Mime parts 
    162160   *               or file handle 
     161   * @param array  Delivery options (e.g. DSN request) 
    163162   * 
    164163   * @return bool  Returns true on success, or false on error 
    165164   */ 
    166   public function send_mail($from, $recipients, &$headers, &$body) 
     165  public function send_mail($from, $recipients, &$headers, &$body, $opts=null) 
    167166  { 
    168167    if (!is_object($this->conn)) 
     
    184183    { 
    185184      $this->reset(); 
    186       $this->response[] .= "Invalid message headers"; 
     185      $this->response[] = "Invalid message headers"; 
    187186      return false; 
    188187    } 
     
    192191    { 
    193192      $this->reset(); 
    194       $this->response[] .= "No From address has been provided"; 
    195       return false; 
     193      $this->response[] = "No From address has been provided"; 
     194      return false; 
     195    } 
     196 
     197    // RFC3461: Delivery Status Notification 
     198    if ($opts['dsn']) { 
     199      $exts = $this->conn->getServiceExtensions(); 
     200 
     201      if (!isset($exts['DSN'])) { 
     202        $this->error = array('label' => 'smtpdsnerror'); 
     203        $this->response[] = "DSN not supported"; 
     204        return false; 
     205      } 
     206 
     207      $from_params      = 'RET=HDRS'; 
     208      $recipient_params = 'NOTIFY=SUCCESS,FAILURE'; 
    196209    } 
    197210 
     
    204217 
    205218    // set From: address 
    206     if (PEAR::isError($this->conn->mailFrom($from))) 
     219    if (PEAR::isError($this->conn->mailFrom($from, $from_params))) 
    207220    { 
    208221      $err = $this->conn->getResponse(); 
    209222      $this->error = array('label' => 'smtpfromerror', 'vars' => array( 
    210223        'from' => $from, 'code' => $this->conn->_code, 'msg' => $err[1])); 
    211       $this->response[] .= "Failed to set sender '$from'"; 
     224      $this->response[] = "Failed to set sender '$from'"; 
    212225      $this->reset(); 
    213226      return false; 
     
    226239    foreach ($recipients as $recipient) 
    227240    { 
    228       if (PEAR::isError($this->conn->rcptTo($recipient))) { 
     241      if (PEAR::isError($this->conn->rcptTo($recipient, $recipient_params))) { 
    229242        $err = $this->conn->getResponse(); 
    230243        $this->error = array('label' => 'smtptoerror', 'vars' => array( 
    231244          'to' => $recipient, 'code' => $this->conn->_code, 'msg' => $err[1])); 
    232         $this->response[] .= "Failed to add recipient '$recipient'"; 
     245        $this->response[] = "Failed to add recipient '$recipient'"; 
    233246        $this->reset(); 
    234247        return false; 
     
    262275 
    263276      $this->error = array('label' => 'smtperror', 'vars' => array('msg' => $msg)); 
    264       $this->response[] .= "Failed to send data"; 
     277      $this->response[] = "Failed to send data"; 
    265278      $this->reset(); 
    266279      return false; 
  • program/localization/en_US/labels.inc

    r1b91421 rf22ea7b  
    210210$labels['editortype']     = 'Editor type'; 
    211211$labels['returnreceipt']  = 'Return receipt'; 
     212$labels['dsn']            = 'Delivery status notification'; 
    212213 
    213214$labels['editidents']    = 'Edit identities'; 
     
    375376$labels['afternseconds']  = 'after $n seconds'; 
    376377$labels['reqmdn'] = 'Always request a return receipt'; 
     378$labels['reqdsn'] = 'Always request a delivery status notification'; 
    377379 
    378380$labels['folder']  = 'Folder'; 
  • program/localization/en_US/messages.inc

    re019f2d rf22ea7b  
    110110$messages['smtptoerror'] = 'SMTP Error ($code): Failed to add recipient "$to" ($msg)'; 
    111111$messages['smtprecipientserror'] = 'SMTP Error: Unable to parse recipients list'; 
     112$messages['smtpdsnerror'] = 'SMTP Error: No support for Delivery Status Notifications'; 
    112113$messages['smtperror'] = 'SMTP Error: $msg'; 
    113114$messages['emailformaterror'] = 'Invalid e-mail address: $email'; 
  • program/localization/pl_PL/labels.inc

    r1b91421 rf22ea7b  
    411411$labels['addmailreplyto'] = 'Dodaj Mail-Reply-To'; 
    412412$labels['addmailfollowupto'] = 'Dodaj Mail-Followup-To'; 
     413$labels['dsn'] = 'Status dostarczenia (DSN)'; 
     414$labels['reqdsn'] = 'Zawsze ŌĠ
     415daj statusu dostarczenia (DSN)'; 
    413416 
    414417?> 
  • program/localization/pl_PL/messages.inc

    re019f2d rf22ea7b  
    154154$messages['smtprecipientserror'] = 'BłĠ
    155155d SMTP: Parsowanie listy odbiorców nie powiodło się'; 
     156$messages['smtpdsnerror'] = 'BłĠ
     157d SMTP: Statusy dostarczenia (DSN) nie sÄ 
     158 obsługiwane przez serwer'; 
    156159$messages['smtperror'] = 'BłĠ
    157160d SMTP: $msg'; 
  • program/steps/mail/compose.inc

    r868deb5 rf22ea7b  
    11751175 
    11761176 
     1177function rcmail_dsn_checkbox($attrib) 
     1178{ 
     1179  global $RCMAIL; 
     1180 
     1181  list($form_start, $form_end) = get_form_tags($attrib); 
     1182  unset($attrib['form']); 
     1183 
     1184  if (!isset($attrib['id'])) 
     1185    $attrib['id'] = 'dsn'; 
     1186 
     1187  $attrib['name'] = '_dsn'; 
     1188  $attrib['value'] = '1'; 
     1189  $checkbox = new html_checkbox($attrib); 
     1190 
     1191  $out = $form_start ? "$form_start\n" : ''; 
     1192  $out .= $checkbox->show($RCMAIL->config->get('dsn_default')); 
     1193  $out .= $form_end ? "\n$form_end" : ''; 
     1194 
     1195  return $out; 
     1196} 
     1197 
     1198 
    11771199function rcmail_editor_selector($attrib) 
    11781200{ 
     
    12521274  'editorselector' => 'rcmail_editor_selector', 
    12531275  'receiptcheckbox' => 'rcmail_receipt_checkbox', 
     1276  'dsncheckbox' => 'rcmail_dsn_checkbox', 
    12541277  'storetarget' => 'rcmail_store_target_selection', 
    12551278)); 
  • program/steps/mail/func.inc

    re25a357 rf22ea7b  
    14791479 * @param array  $smtp_error SMTP error array (reference) 
    14801480 * @param string $body_file  Location of file with saved message body (reference) 
     1481 * @param array  $smtp_opts  SMTP options (e.g. DSN request) 
    14811482 * 
    14821483 * @return boolean Send status. 
    14831484 */ 
    1484 function rcmail_deliver_message(&$message, $from, $mailto, &$smtp_error, &$body_file) 
     1485function rcmail_deliver_message(&$message, $from, $mailto, &$smtp_error, &$body_file, $smtp_opts=null) 
    14851486{ 
    14861487  global $CONFIG, $RCMAIL; 
     
    15261527      $RCMAIL->smtp_init(true); 
    15271528 
    1528     $sent = $RCMAIL->smtp->send_mail($from, $a_recipients, $smtp_headers, $msg_body); 
     1529    $sent = $RCMAIL->smtp->send_mail($from, $a_recipients, $smtp_headers, $msg_body, $smtp_opts); 
    15291530    $smtp_response = $RCMAIL->smtp->get_response(); 
    15301531    $smtp_error = $RCMAIL->smtp->get_error(); 
  • program/steps/mail/sendmail.inc

    re25a357 rf22ea7b  
    547547  } 
    548548 
    549   $sent = rcmail_deliver_message($MAIL_MIME, $from, $mailto, $smtp_error, $mailbody_file); 
     549  // Handle Delivery Status Notification request 
     550  if (!empty($_POST['_dsn'])) { 
     551    $smtp_opts['dsn'] = true; 
     552  } 
     553 
     554  $sent = rcmail_deliver_message($MAIL_MIME, $from, $mailto, 
     555    $smtp_error, $mailbody_file, $smtp_opts); 
    550556 
    551557  // return to compose page if sending failed 
  • program/steps/settings/func.inc

    r868deb5 rf22ea7b  
    525525    } 
    526526 
     527    if (!isset($no_override['dsn_default'])) { 
     528      $field_id = 'rcmfd_dsn_default'; 
     529      $input_dsn = new html_checkbox(array('name' => '_dsn_default', 'id' => $field_id, 'value' => 1)); 
     530 
     531      $blocks['main']['options']['dsn_default'] = array( 
     532        'title' => html::label($field_id, Q(rcube_label('reqdsn'))), 
     533        'content' => $input_dsn->show($config['dsn_default']?1:0), 
     534      ); 
     535    } 
     536 
    527537    if (!isset($no_override['top_posting'])) { 
    528538      $field_id = 'rcmfd_top_posting'; 
  • program/steps/settings/save_prefs.inc

    r868deb5 rf22ea7b  
    6767      'force_7bit'         => isset($_POST['_force_7bit']) ? TRUE : FALSE, 
    6868      'mdn_default'        => isset($_POST['_mdn_default']) ? TRUE : FALSE, 
     69      'dsn_default'        => isset($_POST['_dsn_default']) ? TRUE : FALSE, 
    6970      'show_sig'           => isset($_POST['_show_sig']) ? intval($_POST['_show_sig']) : 1, 
    7071      'top_posting'        => !empty($_POST['_top_posting']), 
  • skins/default/templates/compose.html

    re25a357 rf22ea7b  
    138138        <td><roundcube:object name="receiptCheckBox" form="form" id="rcmcomposereceipt" /></td> 
    139139    </tr><tr> 
     140        <td><label for="rcmcomposedsn"><roundcube:label name="dsn" />:</label></td> 
     141        <td><roundcube:object name="dsnCheckBox" form="form" id="rcmcomposedsn" /></td> 
     142    </tr><tr> 
    140143        <td><label for="rcmcomposepriority"><roundcube:label name="priority" />:</label></td> 
    141144        <td><roundcube:object name="prioritySelector" form="form" id="rcmcomposepriority" /></td> 
Note: See TracChangeset for help on using the changeset viewer.