jamesp@dadla.la.tek.COM ("James T. Perkins") (09/16/88)
> On the subject of aliases, is there any way to get the EXPANDED > version of the alias to show up in the file when you respond with edit > to the "What now?" prompt rather than only when you send the message? Try typing "whom" or "whom -v" at the "What now?" prompt. If you have a line in your .mh_profile that looks similar to this: whom: -alias /usr1/jamesp/.mh_aliases It should look great! _|_ James T. Perkins __|__ |___| |\ Terror tektronix!dadla!jamesp |o__| |___| | \ on the jamesp@dadla.la.tek.com |___| |___| |o \ high _|___| |___| |__o\ seas 4635 S.W. Hillside Drive /...\_____|___|____\_/ Portland, Oregon 97221 \ o * o * * o o / ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Boom!... Boom-BOOM!" (Your turn now to fire back)
wayne@teemc.UUCP (//ichael R. //ayne) (09/30/88)
My original request: >> On the subject of aliases, is there any way to get the EXPANDED >> version of the alias to show up in the file when you respond with edit >> to the "What now?" prompt rather than only when you send the message? Many replied with something similar to the following. I guess I was not sufficiently clear, I tend to be terse. >Try typing "whom" or "whom -v" at the "What now?" prompt. So I will try again. If I define an alias list with a mess of addresses in it, type comp, type a few lines, hit ^D and type edit at the What now? prompt, I go into the editor. My question is: Is there any way that I can have MH expand the alias list BEFORE going into the editor so that every time I edit a message being sent to an alias list I get the real destination IN THE FILE that I am editting? I want to see the actual addresses that the message will be sent to, during the edit process. Further, I want it to be automatic. /\/\ \/\/ -- Michael R. Wayne --- TMC & Associates --- wayne@teemc.uucp INTERNET: wayne%teemc.uucp@umix.cc.umich.edu uunet!umix!teemc!wayne
dce@mips.COM (David Elliott) (10/01/88)
In article <9039@teemc.UUCP> wayne@teemc.UUCP (/\/\ichael R. \/\/ayne) writes: >My original request: >>> On the subject of aliases, is there any way to get the EXPANDED >>> version of the alias to show up in the file when you respond with edit >>> to the "What now?" prompt rather than only when you send the message? > >Many replied with something similar to the following. I guess I was not >sufficiently clear, I tend to be terse. I though your original was quite clear, but it isn't something MH does by default. Your best bet would be to write a program (shell script, probably) that would look for "To:" and "Cc:" lines (and "to:" and "cc:", as well), and uses ali (or maybe you could come up with your own special alias mechanism in addition) to expand each of the items that are potentially aliases. Then, you would set up your first editor to be a script that executes prompter and then runs the above expander to get the aliases. This would also allow "list" at the "What now?" prompt to show you the expanded list. An alternative is to set up a whatnowproc for comp/repl/forw/etc. that runs the alias expander automatically for you. -- David Elliott dce@mips.com or {ames,prls,pyramid,decwrl}!mips!dce
jamesp@dadla.la.tek.COM ("James T. Perkins") (10/03/88)
> Is there any way that I can have MH expand the alias list BEFORE going into > the editor so that every time I edit a message being sent to an alias > list I get the real destination IN THE FILE that I am editting? I want > to see the actual addresses that the message will be sent to, during the > edit process. Further, I want it to be automatic. > Michael R. Wayne --- TMC & Associates --- wayne@teemc.uucp Well, I would suggest looking into the Editor-next capability. The second editor could then process the message, expanding aliases, before reinvoking the editor on it. For example (I tested this), suppose you want to use vi the first time you edit a message, then the next time (when you answer edit to the what now prompt), you want vi back with the To and Cc lines expanded with aliases from you /usr1/jamesp/.mh_aliases file: Your .mh_profile: Editor: vi vi-next: mhvi ali: -alias /usr1/jamesp/.mh_aliases The mhvi program (actually a UNIX shell script), follows. It is an icky hack done to prove that the desired actions could actually be performed. Caveat Emptor!!! _ ___ | | / _ \ James T. Perkins, jamesp@dadla.la.tek.com, (503)629-1149 | |__ | |_| | Tektronix Logic Analyzers, DAS System Software, Disk Services |____||_| |_| MS 92-725, PO Box 4600, Beaverton OR 97075 This package is sold by weight, not by volume. Some settling of contents may have occurred during shipping and handling. ---- cut here ---- : mhvi -- expands "To:", "Cc:" headers in the message with the aid : of awk, sed and ali, then invokes vi on the message. case $# in 1) file="$1";; *) echo "usage: $0 file" 1>&2; exit 1;; esac # get a list of To: recipients. The awk script reads the To: line and all # following To: lines, and builds up a list of recipients. It then echos # each recipient prepended and postpended with "+". There may be some # spaces inside the +'s that will be eaten out later. ToRecipients="` awk ' BEGIN { recip[""] = ""; } $1 ~ /^[Tt]o:$/ { zero = substr($0, length($1) + 1, length($0)); num = split(zero, recip, ","); flag++; next; } flag != 0 && $0 !~ /^[ \t]/ { flag = 0; next; } flag != 0 { newnum = split($0, newrecip, ","); for (i = 1; i <= newnum; i++) { recip[++num] = newrecip[i]; } } END { for (i in recip) { if (recip[i] ~ /[A-Za-z0-9]/) { printf("+%s+", recip[i]); } } } ' $file`" # Turn "+"'s into true delimiters, with no extra whitespace. ToRecipients=`echo $ToRecipients | sed -e 's/[ ]*++[ ]*/" "/g' -e 's/[ ]*+[ ]*/"/g'` echo To: $ToRecipients # get a list of Cc: recipients. The awk script reads the Cc: line and all # following Cc: lines, and builds up a list of recipients. It then echos # each recipient prepended and postpended with "+". There may be some # spaces inside the +'s that will be eaten out later. CcRecipients="` awk ' BEGIN { recip[""] = ""; } $1 ~ /^[Cc]c:$/ { zero = substr($0, length($1) + 1, length($0)); num = split(zero, recip, ","); flag++; next; } flag != 0 && $0 !~ /^[ \t]/ { flag = 0; next; } flag != 0 { newnum = split($0, newrecip, ","); for (i = 1; i <= newnum; i++) { recip[++num] = newrecip[i]; } } END { for (i in recip) { if (recip[i] ~ /[A-Za-z0-9]/) { printf("+%s+", recip[i]); } } } ' $file`" # Turn "+"'s into true delimiters, with no extra whitespace. CcRecipients=`echo $CcRecipients | sed -e 's/[ ]*++[ ]*/" "/g' -e 's/[ ]*+[ ]*/"/g'` echo Cc: $CcRecipients # Now expand the To and Cc recipients using ali. We write short shell # scripts to call ali to accomplish this (because shell quoting is ugly). echo ali $ToRecipients > /tmp/sh.$$ ToAli=`sh < /tmp/sh.$$ | awk '{ if (NR > 1) printf(", "); printf("%s", $0); }'` echo ToAli: $ToAli # Only expand Cc Aliases if there are any to expand case "$CcRecipients" in \"*) echo ali $CcRecipients > /tmp/sh.$$ CcAli=`sh < /tmp/sh.$$ | awk '{ if (NR > 1) printf(", "); printf("%s", $0); }'` echo CcAli: $CcAli ;; *) echo no CcAli; CcAli="";; esac #Okay, now substitute To and Cc lines in the original document with ToAli and #CcAli. awk ' BEGIN { to = "'"$ToAli"'"; cc = "'"$CcAli"'"; } $1 ~ /^[Cc]c:$/ { print "Cc: " cc; flag++; next; } $1 ~ /^[Tt]o:$/ { print "To: " to; flag++; next; } flag != 0 && $0 ~ /^[ \t]/ { next; } { flag = 0; print $0; } ' $file > /tmp/sh.$$ mv /tmp/sh.$$ $file exec vi $file
sylvain@burden.chorus.fr (Sylvain Langlois) (12/15/89)
Is there a simple way NOT to expend aliases when they are gathered in a file, but only the alias itself. I have the following in my aliases file: distribution-list: < members I would like sending mail to everybody in the distribution-list (i.e. members) with the "To:" line saying "distribution-list" only (and not all the members of the list. Eventually (distribution-list@mysite.my-domain would be great too!) I'm running: version: MH 6.5 #47[UCI] (chorus) of Thu Oct 1 15:03:15 MET 1987 options: [BSD42] [BERK] [TTYD] [DUMB] [FOLDPROT='"0700"'] [MHRC] [MSGPROT='"0600"'] [MHE] [NETWORK] [BIND] [RPATHS] [UCI] [SBACKUP='"#"'] [SENDMTS] [SMTP] Thanks for any valuable hints! Sylvain -- ---------------- Sylvain Langlois "Dogmatic attachement to the supposed merits (sylvain@chorus.fr) of a particular structure hinders the search (sylvain%chorus.fr@mcsun.EU.net) of an appropriate structure" (Robert Fripp)
bd@HP-SES.SDE.HP.COM (12/16/89)
> I would like sending mail to everybody in the distribution-list (i.e. > members) with the "To:" line saying "distribution-list" only (and not > all the members of the list. > I'm running: > ... [SENDMTS] [SMTP] Since you're running sendmail, one way to quickly do it is to create a sendmail alias (in sendmail's /usr/lib/aliases file). If the distribution list doesn't change very often, you can add the members directly to the /usr/lib/aliases file. If it changes often, you might be able to convince your Postmaster to use a line of: distribution-list: :include:/usr/local/lib/mail/distribution-list Then edit the file "/usr/local/lib/mail/distribution-list" so it contains lines that look like: him@system.SYS.COM (Hiram I. Muir), her@organization.ORG (Herlinda Evelyn Ramirez), mh-users@ICS.UCI.EDU (MH Users and Abusers) In other words, the contents of the file looks just like the right- hand-side of the aliases in /usr/lib/aliases. Make the file writable by you and readable by sendmail, and you can change it as often as necessary. -- bd
wrf@mab.ecse.rpi.edu (Wm Randolph Franklin) (12/25/89)
In article <8912152304.AA15211@hp-ses.sde.hp.com> bd@HP-SES.SDE.HP.COM writes: >> I would like sending mail to everybody in the distribution-list (i.e. >> members) with the "To:" line saying "distribution-list" only (and not >> all the members of the list. >> I'm running: >> ... [SENDMTS] [SMTP] > >Since you're running sendmail, one way to quickly do it is to create a >sendmail alias (in sendmail's /usr/lib/aliases file). This doesn't work for me since I'm on a client machine and that would require modifying the server's alias file, which is not reasonable. Any other ideas? -- Wm. Randolph Franklin Internet: wrf@ecse.rpi.edu (or @cs.rpi.edu) Bitnet: Wrfrankl@Rpitsmts Telephone: (518) 276-6077; Telex: 6716050 RPI TROU; Fax: (518) 276-6261 Paper: ECSE Dept., 6026 JEC, Rensselaer Polytechnic Inst, Troy NY, 12180
ahl@saussure.technix.oz.au (Tony Landells) (12/26/89)
In article <A&BQD^@rpi.edu> wrf@mab.ecse.rpi.edu (Wm Randolph Franklin) writes:
[Details of using sendmail to do non-expanded aliases deleted.]
This doesn't work for me since I'm on a client machine and that would
require modifying the server's alias file, which is not reasonable. Any
other ideas?
I've never tried it personally, but if you have MH 6.5 or later there
is supposedly the notion of a blind list, where you use something like
To: my work mates: staff;
where staff refers to an alias you have set up normally. MH expands
the alias normally for purposes of sending, but what is received looks
like
To: my work mates: ;
without the actual alias (or its expansion). Is this more useful?
Tony.