Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Feb 1998 23:03:12 -0800 (PST)
From:      asami@FreeBSD.ORG (Satoshi Asami)
To:        Mike Smith <mike@smith.net.au>
Cc:        hackers@FreeBSD.ORG
Subject:   Re: Mailreader with "multiple personalities"?
Message-ID:  <199802170703.XAA03396@silvia.HIP.Berkeley.EDU>

next in thread | raw e-mail | index | archive | help
I use emacs/rmail and pop all my mail from various accounts (most
notably freebsd.org and cs.berkeley.edu).  I just hacked together the
following.  The code is quite ugly as I just patched it together from
various functions (rmail-message-regexp-p, rmail-reply,
rmail-output-to-rmail-file), but it seems to work ok.

The idea here is that you define a list of (regexp address) pairs in
rmail-from-alist, and it will take the address from the first regexp
that matches.  My sample will match a string in any part of the header
but you can further delimit things by using strings like
"Sender:.*owner-@freebsd\\.org" to detect mailing list mails, etc.

Satoshi
-------
(setq rmail-from-alist
      (list
       '("freebsd\\.org" "asami@freebsd.org (Satoshi Asami)")
       '("cvs commit" "asami@freebsd.org (Satoshi Asami)")
       '("." "asami@cs.berkeley.edu (Satoshi Asami)")
       ))

(defun rmail-reply-with-from (just-sender)
  "Reply to the current message.
Normally include CC: to all other recipients of original message;
prefix argument means ignore them.  While composing the reply,
use \\[mail-yank-original] to yank the original message into it."
  (interactive "P")
  (if (and (boundp 'rmail-from-alist)
	   (setq me
		 (let (answer
		       (tail rmail-from-alist))
		   (while (and tail (not answer))
		     (if (save-excursion
			   (save-restriction
			     (widen)
			     (goto-char
			      (rmail-msgbeg rmail-current-message))
			     (let ((end
				    (save-excursion
				      (search-forward
				       "*** EOOH ***"
				       (point-max)) (point))))
			       (re-search-forward (car (car tail)) end t))))
			 (setq answer (car (cdr (car tail)))))
		     (setq tail (cdr tail)))
		   answer)))
      (let ((mail-default-headers
	     (concat "From: " me "\n")))
	(rmail-reply just-sender))
    (rmail-reply just-sender)))

(defun rmail-summary-reply-with-from (just-sender)
  "Reply to the current message.
Normally include CC: to all other recipients of original message;
prefix argument means ignore them.  While composing the reply,
use \\[mail-yank-original] to yank the original message into it."
  (interactive "P")
  (set-buffer rmail-buffer)
  (rmail-reply-with-from just-sender)
  (use-local-map (copy-keymap (current-local-map)))
  (define-key (current-local-map)
    "\C-c\C-c" 'rmail-summary-send-and-exit))

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199802170703.XAA03396>