+if ($default_use_mdn) {
+ if ($mdn_user_support) {
+
+ // debug gives you the capability to remove mdn-flags
+ // $MDNDebug = false;
+
+ if ($header->dnt) {
+ $MDN_to_o = $header->dnt;
+ $MDN_to = $MDN_to_o->getAddress();
+ } else {
+ $MDN_to = '';
+ }
+
+ if ($MDN_to && (!isset( $sendreceipt ) || $sendreceipt == '' ) ) {
+ if ( $message->is_mdnsent && $supportMDN) {
+ $sendreceipt = 'removeMDN';
+
+ $url = "\"read_body.php?mailbox=$mailbox&passed_id=$passed_id&startMessage=$startMessage&show_more=$show_more&sendreceipt=$sendreceipt\"";
+ $sendreceipt='';
+ /*
+ if ($MDNDebug ) {
+ echo html_tag( 'tr', "\n" .
+ html_tag( 'td', _("Read receipt") . ':', 'right', $color[9], 'valign="top"' ) .
+ html_tag( 'td',
+ '<b>' . _("send") . '</b> <a href="' . $url . '">[' . _("Remove MDN flag") . '] </a> ' ,
+ 'left', $color[9], 'colspan="2" valign="top"' )
+ ) . "\n";
+ } else {
+ */
+ echo html_tag( 'tr', "\n" .
+ html_tag( 'td', _("Read receipt") . ':', 'right', $color[9], 'valign="top"' ) .
+ html_tag( 'td',
+ '<b>' . _("send") . '</b> ' ,
+ 'left', $color[9], 'colspan="2" valign="top"' )
+ ) . "\n";
+ /*
+ }
+ */
+
+ } // when deleted or draft flag is set don't offer to send a MDN response
+ else if ( $message->is_draft || $message->is_deleted) {
+ echo html_tag( 'tr', "\n" .
+ html_tag( 'td', _("Read receipt") . ':', 'right', $color[9], 'valign="top"' ) .
+ html_tag( 'td',
+ '<b>' . _("requested") . '</b> ' ,
+ 'left', $color[9], 'colspan="2" valign="top"' )
+ ) . "\n";
+ }
+ // if no MDNsupport don't use the annoying popup messages
+ else if ( !$FirstTimeSee ) {
+ $sendreceipt = 'send';
+ $url = "\"read_body.php?mailbox=$mailbox&passed_id=$passed_id&startMessage=$startMessage&show_more=$show_more&sendreceipt=$sendreceipt\"";
+ echo html_tag( 'tr', "\n" .
+ html_tag( 'td', _("Read receipt") . ':', 'right', $color[9], 'valign="top"' ) .
+ html_tag( 'td',
+ '<b>' . _("requested") . '</b> <a href="' . $url . '">[' . _("Send read receipt now") . ']</a>',
+ 'left', $color[9], 'colspan="2" valign="top"' )
+ ) . "\n";
+ $sendreceipt='';
+ }
+ else {
+ $sendreceipt = 'send';
+ $url = "\"read_body.php?mailbox=$mailbox&passed_id=$passed_id&startMessage=$startMessage&show_more=$show_more&sendreceipt=$sendreceipt\"";
+ if ($javascript_on) {
+ echo "<script language=\"javascript\" type=\"text/javascript\"> \n" .
+ '<!-- ' . "\n" .
+ " if (window.confirm(\"" .
+ _("The message sender has requested a response to indicate that you have read this message. Would you like to send a receipt?") .
+ "\")) { \n" .
+ ' window.open('.$url.',"right");' . "\n" .
+ ' }' . "\n" .
+ '// -->' . "\n" .
+ '</script>' . "\n";
+ }
+ echo html_tag( 'tr', "\n" .
+ html_tag( 'td', _("Read receipt") . ':', 'right', $color[9], 'valign="top"' ) .
+ html_tag( 'td',
+ '<b>' . _("requested") . '</b>  <a href="' . $url . '">[' . _("Send read receipt now") . ']</a>',
+ 'left', $color[9], 'colspan="2" valign="top"' )
+ ) . "\n";
+ $sendreceipt = '';
+ }
+ }
+
+ if ( !isset( $sendreceipt ) || $sendreceipt == '' ) {
+ } else if ( $sendreceipt == 'send' ) {
+ if ( !$MDN_flag_present) {
+ if (isset($identity) ) {
+ $final_recipient = getPref($data_dir, $username, 'email_address' . '0', '' );
+ } else {
+ $final_recipient = getPref($data_dir, $username, 'email_address', '' );
+ }
+
+
+ $final_recipient = trim($final_recipient);
+ if ($final_recipient == '' ) {
+ $final_recipient = getPref($data_dir, $username, 'email_address', '' );
+ }
+
+ if ( SendMDN( $MDN_to, $final_recipient, $message ) > 0 && $supportMDN ) {
+ ToggleMDNflag( true);
+ }
+ ClearAttachments();
+ }
+ $sendreceipt = 'removeMDN';
+ $url = "\"read_body.php?mailbox=$mailbox&passed_id=$passed_id&startMessage=$startMessage&show_more=$show_more&sendreceipt=$sendreceipt\"";
+ $sendreceipt='';
+ /*
+ if ($MDNDebug && $supportMDN) {
+ echo html_tag( 'tr', "\n" .
+ html_tag( 'td', _("Read receipt") . ':', 'right', $color[9], 'valign="top"' ) .
+ html_tag( 'td',
+ '<b>' . _("send") . '</b>  <a href="' . $url . '">[' . _("Remove MDN flag") . ']</a>',
+ 'left', $color[9], 'colspan="2" valign="top"' )
+ ) . "\n";
+ } else {
+ */
+ echo html_tag( 'tr', "\n" .
+ html_tag( 'td', _("Read receipt") . ':', 'right', $color[9], 'valign="top"' ) .
+ html_tag( 'td',
+ '<b>' . _("send") . '</b> ',
+ 'left', $color[9], 'colspan="2" valign="top"' )
+ ) . "\n";
+ /*
+ }
+ */
+ }
+ elseif ($sendreceipt == 'removeMDN' ) {
+ ToggleMDNflag ( false );
+
+ $sendreceipt = 'send';
+ $url = "\"read_body.php?mailbox=$mailbox&passed_id=$passed_id&startMessage=$startMessage&show_more=$show_more&sendreceipt=$sendreceipt\"";
+ echo html_tag( 'tr', "\n" .
+ html_tag( 'td', _("Read receipt") . ':', 'right', $color[9], 'valign="top"' ) .
+ html_tag( 'td',
+ '<b>' . _("requested") . '</b> <a href="' . $url . '">[' . _("Send read receipt now") . ']</a>',
+ 'left', $color[9], 'colspan="2" valign="top"' )
+ ) . "\n";
+ $sendreceipt = '';
+
+ }
+ }
+}
+
+do_hook('read_body_header');
+
+echo '</table>' .
+ ' </td></tr>' .
+ '</table>';