🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.help
Article #189794

Re: mail aliases

#189794
From: Harald Hanche-Olsen
Date: Tue, 06 Nov 1990 20:01
56 lines
2856 bytes
Well, this is an old discussion by now, and perhaps people are happy
about Jamie Zawinski's mail-abbrev.el, posted a short while back...
But then, maybe someone is not, so I thought I would add my two cent's
worth and tell you all how I do mail aliases:

In my .emacs file, I have the following code ...

(defun mail-read-aliases nil
  "Read the mail aliases database from ~/.mail-aliases.el"
  (interactive)
  (load "~/.mail-aliases" nil t)
  ; The above file defines the association list: imail-aliases
  (setq mail-aliases nil))  ; Disable the built-in alias mechanism
(mail-read-aliases)

(setq mail-mode-hook
      '(lambda nil
        (define-key mail-mode-map "\C-c\C-a" 'mail-interactive-insert-alias)
	(setq mail-mode-hook nil)))

(defun mail-interactive-insert-alias nil
  "Insert a mail alias."
  (interactive)
  (insert (or
	    (cdr-safe (assoc 
			(completing-read "Pick an alias: " 
					 imail-aliases nil t) imail-aliases))
	    "")))

This works pretty nice:  I need to send someone mail, I just C-x m and
while in the To: field or Cc: field, type C-c C-a and I can select the
alias I want, with completion and prompting in the minibuffer.  Then
the whole alias is expanded into the letter, letting me see what I
have just done.

I am not so proud of the way the ~/.mail-aliases.el file is made, but
it works ... here it is (most entries deleted):

(setq imail-aliases '(
("apr-admin" . "APR Administrator <apr_cs_admin@apollo.hp.com>")
("aston" . "Aston Mail Server <texserver@tex.aston.ac.uk>")
("miranda" . "Research Software Ltd <mira-request%ukc@nsfnet-relay.ac.uk>")
("siam" . "siam@wharton.upenn.edu")
))

I have a little shell script, that builds this and .mailrc (yes, I
occasionally use /usr/ucb/mail) from a simple database.  This could be
streamlined I guess, but why bother -- it works fine for me!

Hope this will be useful to somebody.  And sure, if RMS wants to use
it in the official code, go ahead and be my guest :-)

- Harald Hanche-Olsen <hanche@imf.unit.no>
  Division of Mathematical Sciences
  The Norwegian Institute of Technology
  N-7034 Trondheim, NORWAY
Technical Details
Message-ID: <HANCHE.90Nov6210103@hufsa.imf.unit.no>
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!sunic!nuug!sigyn.idt.unit.no!ugle.unit.no!hanche
References: <1990Oct26.161932.19187@cbnewsc.att.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 103b8b,f53eff51d8533efd
X-Google-Attributes: gid103b8b,public
X-Google-ArrivalTime: 1990-11-06 12:01:03 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!sunic!nuug!sigyn.idt.unit.no!ugle.unit.no!hanche
From: hanche@imf.unit.no (Harald Hanche-Olsen)
Newsgroups: gnu.emacs.help
Subject: Re: mail aliases
Message-ID: <HANCHE.90Nov6210103@hufsa.imf.unit.no>
Date: 6 Nov 90 20:01:03 GMT
References: <1990Oct26.161932.19187@cbnewsc.att.com>
Sender: news@ugle.unit.no
Organization: The Norwegian Institute of Technology, Trondheim, Norway.
Lines: 56
Posted: Tue Nov  6 21:01:03 1990
In-Reply-To: ladd@cbnewsc.att.com's message of 26 Oct 90 16:19:32 GMT