From: kevin@edscom.demon.co.uk (Kevin Broadey)
Subject: BUG ALERT: sendmail.el - FCC output doesn't have "From: " header field
Organization: EDS-Scicon, Milton Keynes, UK
Distribution: gnu
Date: Wed, 2 Sep 1992 19:38:14 GMT

Don't use the fix I posted.  The fault doesn't exist in the sendmail.el
distributed with either emacs 18.57 or 18.58, it's in a modified version
of sendmail.el that I posted a couple of weeks ago.

My modified version checked whether the FCC file was already being
visited by Emacs in RMAIL mode, and if so attempted to append the FCC
message to the RMAIL buffer in BABYL format.  BUT THE FORMAT CONVERSION
FUNCTION WAS WRONG.

Here is the diffs file relative to sendmail.el 18.57 that does the
conversion correctly by calling RMAIL's own `rmail-convert-to-babyl-format'
function.

It also fixes a longstanding bug in sendmail - RMAIL's BABYL conversion
function expects the time to be in the format output by the UNIX `date'
command, not the format provided by (current-time-string).  This is the
fault that was really causing RMAIL summary lines to screw up.

Millions and millions of appologies to everyone whose FCC files have
been screwed up.

-- snip -- snip -- snip -- snip -- snip -- snip -- snip -- snip -- snip --

*** sendmail.el
--- sendmail.el.old
***************
*** 17,34 ****
  ;; along with GNU Emacs; see the file COPYING.  If not, write to
  ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  
- ;; 02-09-92  Kevin Broadey  EDS-Scicon
- ;; File Carbon Copy feature: Change mail-do-fcc to spot when the buffer
- ;; visiting the FCC file is in RMAIL mode and make it append the message in
- ;; BABYL format, updating rmail's variables as well.  Also, ask whether to
- ;; append to a read-only buffer instead of bombing out.
- ;;
- ;; This has been unashamedly lifted from the GNUS `gnus-output-to-rmail'
- ;; function.
- ;;
- ;; Also, fix longstanding bug in FCC: Use UNIX `date' instead of
- ;; `current-time-string' to get timestamp so Rmail parses it successfully when
- ;; converting to BABYL format.
  
  (provide 'sendmail)
  
--- 17,22 ----
***************
*** 196,202 ****
      (unwind-protect
  	(save-excursion
  	  (set-buffer tembuf)
- 	  (setq buffer-undo-list t)
  	  (erase-buffer)
  	  (insert-buffer-substring mailbuf)
  	  (goto-char (point-max))
--- 184,189 ----
***************
*** 286,293 ****
  		       (progn (forward-line 1) (point))))
        (set-buffer tembuf)
        (erase-buffer)
!       (insert "\nFrom " (user-login-name) " ")
!       (call-process "date" nil t nil)
        (insert-buffer-substring rmailbuf)
        ;; Make sure messages are separated.
        (goto-char (point-max))
--- 273,280 ----
  		       (progn (forward-line 1) (point))))
        (set-buffer tembuf)
        (erase-buffer)
!       (insert "\nFrom " (user-login-name) " "
! 	      (current-time-string) "\n")
        (insert-buffer-substring rmailbuf)
        ;; Make sure messages are separated.
        (goto-char (point-max))
***************
*** 306,338 ****
  	      ;; File is present in a buffer => append to that buffer.
  	      (let ((curbuf (current-buffer))
  		    (beg (point-min)) (end (point-max)))
! 		(set-buffer buffer)
! 		(if (eq major-mode 'rmail-mode)
! 		    ;; buffer is in RMAIL mode - be clever with messages.
! 		    (let ((buffer-read-only nil)
! 			  (curmsg rmail-current-message))
! 		      (widen)
! 		      (narrow-to-region (point-max) (point-max))
! 		      (insert-buffer-substring curbuf beg end)
! 		      (rmail-convert-to-babyl-format)
! 		      (goto-char (point-min))
! 		      (widen)
! 		      (search-backward "\^_")
! 		      (narrow-to-region (point) (point-max))
! 		      (goto-char (1+ (point-min)))
! 		      (rmail-count-new-messages t)
! 		      (rmail-show-message curmsg))
! 		  ;; Else not in rmail-mode - tag message on at end.
! 		  (if (or (not buffer-read-only)
! 			  (y-or-n-p
! 			   (format "Buffer %s is read-only. Append anyway? "
! 				   (buffer-name buffer))))
! 		      (let ((buffer-read-only nil))
! 			(save-excursion
! 			  (save-restriction
! 			    (goto-char (point-max))
! 			    (insert-buffer-substring curbuf beg end))))
! 		    )))
  	    ;; Else append to the file directly.
  	    (write-region (point-min) (point-max) (car fcc-list) t)))
  	(setq fcc-list (cdr fcc-list))))
--- 293,302 ----
  	      ;; File is present in a buffer => append to that buffer.
  	      (let ((curbuf (current-buffer))
  		    (beg (point-min)) (end (point-max)))
! 		(save-excursion
! 		  (set-buffer buffer)
! 		  (goto-char (point-max))
! 		  (insert-buffer-substring curbuf beg end)))
  	    ;; Else append to the file directly.
  	    (write-region (point-min) (point-max) (car fcc-list) t)))
  	(setq fcc-list (cdr fcc-list))))

-- snip -- snip -- snip -- snip -- snip -- snip -- snip -- snip -- snip --

--
Kevin Broadey <kbroadey@edscom.demon.co.uk>
EDS-Scicon, Wavendon Tower, Wavendon, Milton Keynes, MK17 8LX, England.
Phone: +44 908 284198 (direct) or +44 908 585858 ext 4198
These opinions are mine: others available on request.