Gnus development mailing list
 help / color / mirror / Atom feed
* Handling Resent-CC and -BCC in sendmail.el
@ 1995-12-08 21:51 David K}gedal
  1995-12-08 23:48 ` Sten Drescher
  0 siblings, 1 reply; 2+ messages in thread
From: David K}gedal @ 1995-12-08 21:51 UTC (permalink / raw)


In GNU Emacs 19.30.1 (sparc-sun-solaris2.4, X toolkit) of Tue Nov 28 1995 on tiny
configured using `configure  --prefix=/usr/gnu --with-x-toolkit'

When sending mail containing a "Resent-To: foobar" header, the
function sendmail-send-it sees that this is a forwarded mail, and
makes sure that sendmail is not called with -t, but instead finds the
addresses in the "Resent-To:" header and gives them to sendmail.

But it doesn't do anything with Resent-CC or Resent-BCC headers. They
are equally valid headers, although maybe less likely to appear. But
anyway, here is a patch that handles these cases, including removal of
any Resent-BCC headers before actual sending. I believe recent
versions of sendmail can take care of the last bit itself, but many
versions don't.

First a changelog entry

Fri Dec  8 22:44:15 1995  David K}gedal  <davidk@lysator.liu.se>

	* sendmail.el (sendmail-send-it): Added support for Resent-CC and
	Resent-BCC headers.

*** /usr/gnu/share/emacs/19.30/lisp/sendmail.el	Fri Nov 10 18:23:39 1995
--- sendmail.el	Fri Dec  8 22:40:37 1995
***************
*** 493,499 ****
  	    (replace-match "\n"))
  	  (let ((case-fold-search t))
  	    (goto-char (point-min))
! 	    (while (re-search-forward "^Resent-to:" delimline t)
  	      (setq resend-to-addresses
  		    (save-restriction
  		      (narrow-to-region (point)
--- 493,499 ----
  	    (replace-match "\n"))
  	  (let ((case-fold-search t))
  	    (goto-char (point-min))
! 	    (while (re-search-forward "^Resent-\\(to\\|cc\\|bcc\\):" delimline t)
  	      (setq resend-to-addresses
  		    (save-restriction
  		      (narrow-to-region (point)
***************
*** 501,507 ****
  					  (end-of-line)
  					  (point)))
  		      (append (mail-parse-comma-list)
! 			      resend-to-addresses))))
  ;;; Apparently this causes a duplicate Sender.
  ;;;	    ;; If the From is different than current user, insert Sender.
  ;;;	    (goto-char (point-min))
--- 501,512 ----
  					  (end-of-line)
  					  (point)))
  		      (append (mail-parse-comma-list)
! 			      resend-to-addresses)))
! 	      ;; Delete Resent-BCC ourselves
! 	      (if (save-excursion (beginning-of-line)
! 				  (looking-at "resent-bcc"))
! 		  (delete-region (save-excursion (beginning-of-line) (point))
! 				 (save-excursion (end-of-line) (1+ (point))))))
  ;;; Apparently this causes a duplicate Sender.
  ;;;	    ;; If the From is different than current user, insert Sender.
  ;;;	    (goto-char (point-min))


-- 
David Kågedal     Lysator Academic Computer Society       davidk@lysator.liu.se
http://www.lysator.liu.se/~davidk/                              +46-13 17 65 89


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Handling Resent-CC and -BCC in sendmail.el
  1995-12-08 21:51 Handling Resent-CC and -BCC in sendmail.el David K}gedal
@ 1995-12-08 23:48 ` Sten Drescher
  0 siblings, 0 replies; 2+ messages in thread
From: Sten Drescher @ 1995-12-08 23:48 UTC (permalink / raw)


David Kågedal <davidk@lysator.liu.se> said:

DK> In GNU Emacs 19.30.1 (sparc-sun-solaris2.4, X toolkit) of Tue Nov 28
DK> 1995 on tiny configured using `configure --prefix=/usr/gnu
DK> --with-x-toolkit'

DK> When sending mail containing a "Resent-To: foobar" header, the
DK> function sendmail-send-it sees that this is a forwarded mail, and
DK> makes sure that sendmail is not called with -t, but instead finds
DK> the addresses in the "Resent-To:" header and gives them to sendmail.

DK> But it doesn't do anything with Resent-CC or Resent-BCC
DK> headers. They are equally valid headers, although maybe less likely
DK> to appear. But anyway, here is a patch that handles these cases,
DK> including removal of any Resent-BCC headers before actual sending. I
DK> believe recent versions of sendmail can take care of the last bit
DK> itself, but many versions don't.

	As sendmail 8.7.1 (possibly earlier) can handle Resent-*
headers, here is an additional patch (combined with David Kågedal's)
which allows sendmail to handle the resending.

DK> First a changelog entry

Fri Dec 8 23:36:46 1995 Sten Drescher <dreschs@mpd.tandem.com>

	* sendmail.el: Added sendmail-resends variable to indicate that
	sendmail can handle Resent-* headers

	* sendmail.el (sendmail-send-it): Checks sendmail-resends before
	doing internal processing of Resent-* headers.

Fri Dec 8 22:44:15 1995 David K}gedal <davidk@lysator.liu.se>

	* sendmail.el (sendmail-send-it): Added support for Resent-CC
	and Resent-BCC headers.

*** /usr/remote/share/emacs/19.30/lisp/sendmail.el	Fri Nov 10 11:23:39 1995
--- sendmail.el	Fri Dec  8 17:24:39 1995
***************
*** 61,67 ****
--- 61,73 ----
  The headers should be delimited by a line whose contents
  match the variable `mail-header-separator'.")
  
+ ;; Should be set in site-init.el
  ;;;###autoload
+ (defvar sendmail-resends nil "\
+ *If t, the sendmail-program will handle Resent messages.
+ Otherwise, the send-mail-function must.")
+ 
+ ;;;###autoload
  (defvar mail-header-separator "--text follows this line--" "\
  *Line used to separate headers from text in messages being composed.")
  
***************
*** 492,507 ****
  		      (< (point) delimline))
  	    (replace-match "\n"))
  	  (let ((case-fold-search t))
! 	    (goto-char (point-min))
! 	    (while (re-search-forward "^Resent-to:" delimline t)
! 	      (setq resend-to-addresses
! 		    (save-restriction
! 		      (narrow-to-region (point)
! 					(save-excursion
! 					  (end-of-line)
! 					  (point)))
! 		      (append (mail-parse-comma-list)
! 			      resend-to-addresses))))
  ;;; Apparently this causes a duplicate Sender.
  ;;;	    ;; If the From is different than current user, insert Sender.
  ;;;	    (goto-char (point-min))
--- 498,520 ----
  		      (< (point) delimline))
  	    (replace-match "\n"))
  	  (let ((case-fold-search t))
! 	    (if (not (eq sendmail-resends t))
! 		(progn
! 		  (goto-char (point-min))
! 		  (while (re-search-forward "^Resent-\\(to\\|cc\\|bcc\\):" delimline t)
! 		    (setq resend-to-addresses
! 			  (save-restriction
! 			    (narrow-to-region (point)
! 					      (save-excursion
! 						(end-of-line)
! 						(point)))
! 			    (append (mail-parse-comma-list)
! 				    resend-to-addresses)))
! 		    ;; Delete Resent-BCC ourselves
! 		    (if (save-excursion (beginning-of-line)
! 					(looking-at "resent-bcc"))
! 			(delete-region (save-excursion (beginning-of-line) (point))
! 				       (save-excursion (end-of-line) (1+ (point))))))))
  ;;; Apparently this causes a duplicate Sender.
  ;;;	    ;; If the From is different than current user, insert Sender.
  ;;;	    (goto-char (point-min))
***************
*** 599,609 ****
  			   ;; and "deliver in background".
  			   (if (null mail-interactive) '("-oem" "-odb"))
  			   ;; Get the addresses from the message
! 			   ;; unless this is a resend.
  			   ;; We must not do that for a resend
  			   ;; because we would find the original addresses.
  			   ;; For a resend, include the specific addresses.
! 			   (or resend-to-addresses
  			       '("-t")))))
  	  (if mail-interactive
  	      (save-excursion
--- 612,624 ----
  			   ;; and "deliver in background".
  			   (if (null mail-interactive) '("-oem" "-odb"))
  			   ;; Get the addresses from the message
! 			   ;; unless this is a resend and sendmail-resends
! 			   ;; is not t.
  			   ;; We must not do that for a resend
  			   ;; because we would find the original addresses.
  			   ;; For a resend, include the specific addresses.
! 			   (or (if (not (eq sendmail-resends t)) 
! 				   resend-to-addresses)
  			       '("-t")))))
  	  (if mail-interactive
  	      (save-excursion
--
DK> David Kågedal Lysator Academic Computer Society	davidk@lysator.liu.se
DK> http://www.lysator.liu.se/~davidk/                     +46-13 17 65 89

-- 
#include <disclaimer.h>				/* Sten Drescher */
To get my PGP public key, send me email with your public key and
	Subject: PGP key exchange
Key fingerprint =  90 5F 1D FD A6 7C 84 5E  A9 D3 90 16 B2 44 C4 F3


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1995-12-08 23:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1995-12-08 21:51 Handling Resent-CC and -BCC in sendmail.el David K}gedal
1995-12-08 23:48 ` Sten Drescher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).