[gnu.emacs.bug] sendmail.el: problems with user-specified "From" fields

cutting@bopp.PARC.xerox.com (Doug Cutting) (09/16/89)

When one specifies a "From" line in a messge being sent a "Sender"
line is inserted unless one is already present.  This has two
problems: (1) if the "From" line contains the same address as the
current user then the "Sender" line is annoyingly redundant; and (2)
users are allowed to specify "Sender" lines.

Following are diffs for emacs 18.54 sendmail.el which fix these.
First, user-provided "Sender" fields are prohibited.  Second, "Sender"
fields are only inserted when the address on the "From" line (if
present) is different than the current user.

	Doug

207a208,210
> 	    (goto-char (point-min))
> 	    (if (re-search-forward "^Sender:" delimline t)
> 		(error "Sender may not be specified."))
212c215
< 	    ;; If there is a From and no Sender, put it a Sender.
---
> 	    ;; If the From is different than current user, insert Sender
215,217c218,224
< 		 (not (save-excursion
< 			(goto-char (point-min))
< 			(re-search-forward "^Sender:" delimline t)))
---
> 		 (require 'mail-utils)
> 		 (not (string-equal
> 		       (mail-strip-quoted-names
> 			(save-restriction
> 			  (narrow-to-region (point-min) delimline)
> 			  (mail-fetch-field "From")))
> 		       (user-login-name)))