[comp.emacs] Mail has the wrong originator

ramiro@rrunner.ctt.bellcore.com (Ramiro Reinoso) (10/02/90)

I recently compiled version 18.52 of GNU emacs on a Sparcstation 1
that runs UNIX 4.0.3.  Everything works fine except the mailer.  All
the messages that I send have the recipient as the originator of the
message.  I don't want to impersonate other people, so does anybody
have a fix for this problem ?

Thanks ...

Ramiro Reinoso, 444 Hoes Lane, Office RRC-1E-226. Piscataway, NJ 08854
(PHONE) (201) 699-5021  
(INTERNET) ramiro@ctt.bellcore.com
(UUCP)  ...!bellcore!ctt!ramiro

kthompso@ptolemy.arc.nasa.gov (Kevin Thompson) (10/03/90)

In article <27420@bellcore.bellcore.com> ramiro@rrunner.ctt.bellcore.com (Ramiro Reinoso) writes:
>I recently compiled version 18.52 of GNU emacs on a Sparcstation 1
>that runs UNIX 4.0.3.  Everything works fine except the mailer.  All
>the messages that I send have the recipient as the originator of the
>message.  I don't want to impersonate other people, so does anybody
>have a fix for this problem ?

This has come up multiple times in this newsgroup recently (twice today),
and we wrestled with it for months.  Here is the change our local Sun guru
made, that fixed it but we weren't sure why.  The change is in,
unsurprisingly, sendmail-send-it in sendmail.el.  I frankly don't understand
why this works (or why it's lasted so long in the distribution), but it did
the trick for us, and I've not seen anyone else post a bug-fix.  We thought
we were the only people running into this :).

Kevin Thompson

*** sendmail.el.new	Tue Sep 11 10:20:54 1990
--- sendmail.el.old	Fri Dec 22 20:37:13 1989
***************
*** 230,246 ****
  		 (append (list (point-min) (point-max)
  			       (if (boundp 'sendmail-program)
  				   sendmail-program
  				 "/usr/lib/sendmail")
  			       nil errbuf nil
! 			       "-oi" "-t" "-f")
  			 ;; Don't say "from root" if running under su.
! 			 ;;  but always give '-f user' -- 9/6/90
! 			 (list (cond ((equal (user-real-login-name) "root") (user-login-name))
! 			       	     (t (user-real-login-name))))
! 			 ;(and (equal (user-real-login-name) "root")
! 			 ;     (list "-f" (user-login-name)))
  			 ;; These mean "report errors by mail"
  			 ;; and "deliver in background".
  			 (if (null mail-interactive) '("-oem" "-odb"))))
--- 240,253 ----
  		 (append (list (point-min) (point-max)
  			       (if (boundp 'sendmail-program)
  				   sendmail-program
  				 "/usr/lib/sendmail")
  			       nil errbuf nil
! 			       "-oi" "-t")
  			 ;; Don't say "from root" if running under su.
! 			 (and (equal (user-real-login-name) "root")
! 			      (list "-f" (user-login-name)))
  			 ;; These mean "report errors by mail"
  			 ;; and "deliver in background".
  			 (if (null mail-interactive) '("-oem" "-odb"))))

--
kthompso@ptolemy.arc.nasa.gov     NASA-Ames Research Center, Moffett Field, CA

kim@Software.Mitel.com (Kim Letkeman) (10/05/90)

In article <8347@ptolemy.arc.nasa.gov> kthompso@ptolemy.arc.nasa.gov (Kevin Thompson) writes:

| In article <27420@bellcore.bellcore.com> ramiro@rrunner.ctt.bellcore.com (Ramiro Reinoso) writes:
| >I recently compiled version 18.52 of GNU emacs on a Sparcstation 1
| >that runs UNIX 4.0.3.  Everything works fine except the mailer.  All
| >the messages that I send have the recipient as the originator of the
| >message.  I don't want to impersonate other people, so does anybody
| >have a fix for this problem ?
| 
| This has come up multiple times in this newsgroup recently (twice today),
| and we wrestled with it for months.  Here is the change our local Sun guru
| made, that fixed it but we weren't sure why.  The change is in,
| unsurprisingly, sendmail-send-it in sendmail.el.  I frankly don't understand
| why this works (or why it's lasted so long in the distribution), but it did
| the trick for us, and I've not seen anyone else post a bug-fix.  We thought
| we were the only people running into this :).
| 

We tried this type of fix (using the -f option of sendmail) and were
unsatisfied with the results. We had very unusual behaviour on our
mail server. We ended up with many badly behaved processes causing it
to bog down. The -f option requires that the users be in the "trusted"
file or something like that and this just didn't seem to work well for
our configuration.

As well, we found a bug in the alias handling of emacs. It does not
handle multi-word aliases (like pipes) properly at all. Someone here
created a simple mail address that would automatically post to the
local news groups, but it failed under VM.

Anyway, our final solution works well and gets around all these
problems (at least for the last year.)

We are using the actual Berkeley mail program as the mailer. This
involves translating the headers into Berkeley's format and then
inserting a space in front of any line containing a "~" as the first
character.

Works for us.

Kim

P.S. Before anyone flames this on the platform that it's inefficient,
we decided that the difference was insignificant when you consider the
amount of mail that the average interactive user sends in a day.

following output is from diff -e <old sendmail.el> <new>
--------------cut-here--------------------------------------------
235,244c
			       mail-recipient)))
.
231,233c
			       "mail"
.
228a
	  (save-excursion
	    (beginning-of-buffer)
	    (replace-regexp "^~" " ~"))
.
224a
	    ; now make changes required to use Berkeley mailer
	    (goto-char (point-min))
	    (setq mail-recipient "recipient_not_specified")
	    (if (re-search-forward "^To:" delimline t)
		(progn
		  (replace-match "~t" t)
		  (beginning-of-line)
		  (forward-char 2)
		  (if (re-search-forward "[ \t]*")
		      (if (re-search-forward "[^ \t,\n]*")
			  (progn
			    (setq mail-recipient (buffer-substring (match-beginning 0) (match-end 0)))
			    (replace-match ""))))))
	    (goto-char (point-min))
	    (if (re-search-forward "^cc:" delimline t)
		(replace-match "~c" t))
	    (goto-char (point-min))
	    (if (re-search-forward "^bcc:" delimline t)
		(replace-match "~b" t))
	    (goto-char (point-min))
	    (if (re-search-forward "^subject:" delimline t)
		(replace-match "~s" t))
.
200,201d


--
Kim Letkeman	kim@software.mitel.com
		uunet!mitel!spock!kim