Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!bbn!apple!rutgers!tut.cis.ohio-state.edu!bloom-beacon!bu-cs!att!homxb!ho7cad!wjc From: wjc@ho5cad.ATT.COM (Bill Carpenter) Newsgroups: comp.emacs Subject: Re: making GNU Emacs talk SMTP Message-ID: Date: 26 Mar 89 19:10:06 GMT References: <89@ <94600020@hcx3> Sender: nuucp@ho7cad.ATT.COM Reply-To: wjc@ho5cad.att.com (Bill Carpenter) Distribution: comp Organization: AT&T Bell Laboratories Lines: 137 In-reply-to: shirono@hcx3.SSD.HARRIS.COM's message of 24 Mar 89 15:31:00 GMT In article <94600020@hcx3> shirono@hcx3.SSD.HARRIS.COM writes: >My particular problem is that I have recently encountered a system where the >"-t" option of sendmail ("read recipients from message") is restricted to >... > - Write a C program to go in ${EMACS}/etc to send the message (much > like movemail), parsing it appropriately and invoking an > appropriate service. > - Rewrite sendmail.el to use some other mail agent (/bin/mail, *Poof* You dreams can come true. There is already etc/fakemail which is used by sites that don't have sendmail (and for those like me who choose to ignore it). Out of the box, it gathers up addresses from the "TO:", "CC:", and "BCC:" lines, drops the "BCC:" from the message, and pipes into /bin/mail. A couple months back, I posted some diffs to make etc/fakemail also drop (comments) from the address list, linewrap the embedded address lists, and let you optionally pipe into something other than /bin/mail. If you missed the posted diffs and would like them, send me some mail. (I concur with the idea that this kind of jazz ought to be done in the elips and get rid of etc/fakemail, but it was easier for me to write 30 lines in C than 200 lines in elisp.) While we're on the subject of sending mail, here is something I use to get my failed mail in a real buffer instead of just crammed into the minibuffer: ;;---------------- badmailbuf.el ;; swiped from sendmail-send-it in sendmail.el by att!ho5cad!wjc ;; ;; The difference is that this one plops its stuff into a buffer ;; instead of the minibuffer if mail fails ;; (defun badmailbuf:sendmail-send-it () (let ((errbuf (if mail-interactive (get-buffer-create "*mail errors*") 0)) (tembuf (generate-new-buffer " sendmail temp")) (case-fold-search nil) delimline (mailbuf (current-buffer))) (unwind-protect (save-excursion (set-buffer tembuf) (erase-buffer) (insert-buffer-substring mailbuf) (goto-char (point-max)) ;; require one newline at the end. (or (= (preceding-char) ?\n) (insert ?\n)) ;; Change header-delimiter to be what sendmail expects. (goto-char (point-min)) (re-search-forward (concat "^" (regexp-quote mail-header-separator) "\n")) (replace-match "\n") (backward-char 1) (setq delimline (point-marker)) (if mail-aliases (expand-mail-aliases (point-min) delimline)) (goto-char (point-min)) ;; ignore any blank lines in the header (while (and (re-search-forward "\n\n\n*" delimline t) (< (point) delimline)) (replace-match "\n")) (let ((case-fold-search t)) ;; Find and handle any FCC fields. (goto-char (point-min)) (if (re-search-forward "^FCC:" delimline t) (mail-do-fcc delimline)) ;; If there is a From and no Sender, put it a Sender. (goto-char (point-min)) (and (re-search-forward "^From:" delimline t) (not (save-excursion (goto-char (point-min)) (re-search-forward "^Sender:" delimline t))) (progn (forward-line 1) (insert "Sender: " (user-login-name) "\n"))) ;; don't send out a blank subject line (goto-char (point-min)) (if (re-search-forward "^Subject:[ \t]*\n" delimline t) (replace-match "")) (if mail-interactive (save-excursion (set-buffer errbuf) (erase-buffer)))) (apply 'call-process-region (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")))) ) ) (kill-buffer tembuf) (if mail-interactive (progn (set-buffer errbuf) (if (zerop (buffer-size)) (kill-buffer errbuf) (display-buffer errbuf) (error "Sending...failed") ) (set-buffer mailbuf) ) ))) ; From wjc Sun Jan 1 22:11 EST 1989 ; To:... ; Subject: bad mail buffer ; Reply-to: att!ho5cad!wjc ; ; I have found a way to make failed mail come back to a regular buffer ; (instead of the minibuffer) so that you can see the whole deal. You ; should just have to do this someplace: ; ; (setq mail-interactive t) ; (setq send-mail-function 'badmailbuf:sendmail-send-it) ; (autoload 'badmailbuf:sendmail-send-it "badmailbuf") ; (setenv "FAKEMAILER" "/bin/mail") ;; optional ... can leave it unset ; ; Let me know if you try this and it doesn't work right. ; -- ; Bill Carpenter att!ho5cad!wjc or attmail!bill ; -- -- Bill Carpenter att!ho5cad!wjc or attmail!bill