# PaCkAgE DaTaStReAm SRBprocm 1 484 # end of header 07070100006785000081a400000064000000640000000132f512fa000000d2000000200000001b00000000000000000000001100000004SRBprocm/pkginfoPKG=SRBprocm NAME=procmail ARCH=Solaris 2.5.1 VERSION=3.10 CATEGORY=application VENDOR=Stephen R. van den Berg EMAIL=berg@pool.informatik.rwth-aachen.de PSTAMP=D.J. Gregor BASEDIR=/opt/SRBprocmail CLASSES=none 07070100006784000081a400000064000000640000000132f512fb000005ab000000200000001b00000000000000000000001000000004SRBprocm/pkgmap: 1 484 1 d none bin 0555 root root 1 f none bin/formail 0555 root root 30332 5271 854921616 1 f none bin/lockfile 0555 root root 10516 53569 854921616 1 f none bin/mailstat 0555 root root 5390 59672 854921616 1 f none bin/procmail 0555 root root 65564 62048 854921616 1 d none examples 0555 root root 1 f none examples/1procmailrc 0444 root root 644 51527 769959999 1 f none examples/1rmail 0444 root root 400 31182 769959409 1 f none examples/2procmailrc 0444 root root 1989 35116 769960000 1 f none examples/2rmail 0444 root root 392 30468 769959410 1 f none examples/3procmailrc 0444 root root 1533 57787 769960001 1 f none examples/3rmail 0444 root root 757 61542 769959412 1 f none examples/advanced 0444 root root 11562 17515 780864209 1 f none examples/dirname 0555 root root 537 32336 769961512 1 f none examples/forward 0444 root root 75 5793 774629114 1 f none examples/mailstat 0555 root root 5390 59672 769961514 1 d none man 0555 root root 1 d none man/man1 0555 root root 1 f none man/man1/formail.1 0444 root root 11188 44682 854921655 1 f none man/man1/lockfile.1 0444 root root 6085 63149 854921655 1 f none man/man1/procmail.1 0444 root root 24645 58403 854921655 1 d none man/man5 0555 root root 1 f none man/man5/procmailex.5 0444 root root 14924 29235 854921655 1 f none man/man5/procmailrc.5 0444 root root 25274 34231 854921655 1 f none man/man5/procmailsc.5 0444 root root 7990 14939 854921655 1 i pkginfo 210 17273 854921978 07070100000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000b00000000TRAILER!!!07070100006785000081a400000064000000640000000132f512fa000000d2000000200000001b00000000000000000000000800000004pkginfoPKG=SRBprocm NAME=procmail ARCH=Solaris 2.5.1 VERSION=3.10 CATEGORY=application VENDOR=Stephen R. van den Berg EMAIL=berg@pool.informatik.rwth-aachen.de PSTAMP=D.J. Gregor BASEDIR=/opt/SRBprocmail CLASSES=none 07070100006784000081a400000064000000640000000132f512fb000005ab000000200000001b00000000000000000000000700000004pkgmap: 1 484 1 d none bin 0555 root root 1 f none bin/formail 0555 root root 30332 5271 854921616 1 f none bin/lockfile 0555 root root 10516 53569 854921616 1 f none bin/mailstat 0555 root root 5390 59672 854921616 1 f none bin/procmail 0555 root root 65564 62048 854921616 1 d none examples 0555 root root 1 f none examples/1procmailrc 0444 root root 644 51527 769959999 1 f none examples/1rmail 0444 root root 400 31182 769959409 1 f none examples/2procmailrc 0444 root root 1989 35116 769960000 1 f none examples/2rmail 0444 root root 392 30468 769959410 1 f none examples/3procmailrc 0444 root root 1533 57787 769960001 1 f none examples/3rmail 0444 root root 757 61542 769959412 1 f none examples/advanced 0444 root root 11562 17515 780864209 1 f none examples/dirname 0555 root root 537 32336 769961512 1 f none examples/forward 0444 root root 75 5793 774629114 1 f none examples/mailstat 0555 root root 5390 59672 769961514 1 d none man 0555 root root 1 d none man/man1 0555 root root 1 f none man/man1/formail.1 0444 root root 11188 44682 854921655 1 f none man/man1/lockfile.1 0444 root root 6085 63149 854921655 1 f none man/man1/procmail.1 0444 root root 24645 58403 854921655 1 d none man/man5 0555 root root 1 f none man/man5/procmailex.5 0444 root root 14924 29235 854921655 1 f none man/man5/procmailrc.5 0444 root root 25274 34231 854921655 1 f none man/man5/procmailsc.5 0444 root root 7990 14939 854921655 1 i pkginfo 210 17273 854921978 07070100000f01000041ed00000064000000640000000532f512fb00000000000000200000001b00000000000000000000000600000004reloc0707010000ceb6000041ed00000064000000640000000232f512fb00000000000000200000001b00000000000000000000000a00000004reloc/bin0707010000ceb7000081a400000064000000640000000132f511900000767c000000200000001b00000000000000000000001200000004reloc/bin/formailELFp4s\4 (44mimimlml|Pmxmx/usr/lib/ld.so.1h>W.4LTXHx1kF[qGAM~#vj0s n*di\7|oB^El_bN)pO98P({}awu/t+!?"`cIz'er%&5@:,6D2J<K-;YRQ=3Vfm]CZg$yUSxlpXX X ml mx n p0pppR  ptWlq$q.W4E\=DEnLq UtZnbnionq$xsH@!}nxml oq(q0 C4o,pnnHnTG IHPs<opX gP o8nG`&U8,-o3s@:QH<CoIoDNIl<Yo _gh hB0(pIynF(ooo\mx W4nsDWL8sH@J,ogX  XhNloPpnKT to#n`)D(2t:VBq JPRT YtanhpmotsU8|tQoOx4C tUddpn ntBXtonU  ttmi X ,p2p8q0 !?GH#tMDDToZF$`oitpnlwohO\Nt<tptX tpstartprog_starthostnamerdheaderoldstdouttfreestrnIcmpwaitforstrtol_environ_endmemmovegetpidforklenfileno_iob__flsbuf_GLOBAL_OFFSET_TABLE_piperhash__ctypedetabfseeknrtotalsignalatexitexitdelfielddispfieldelogbuflastmallocuname_initbinshfwritedupconcatenatelogqnlfputsbuflenltputssn.uremtimeflushfieldftellcouldntweqFrom_readheadfcloseclear_uheadwaitwaitpidstrncpy_DYNAMICtmallocstrncmplogsummarytrealloc__iobaddbufexecvsfolderultoanloadbufctimereallocstrpbrkskipwordszapfdopen_exitskpspaceXheadersstrstrenvirontputssnnofildxheaderstrchrfreecloseopensinktotallenlputcsfgetcgetlineshexecnrskipclosemine_edata_PROCEDURE_LINKAGE_TABLE_fopenmystdoutbreakfieldlexitcodeexecvpstrcpynlogbuffilledbuf_etext_lib_versionquietchild_ctypeaddfieldmainultstr.udivfindf__filbuferroutstrlenstrcspnloadcharloadsavedinitfilenoffilenoUheader_finiuheaderretvallibm.so.1libsocket.so.1libnsl.so.1libc.so.1q sHOq0(nH-nT.n`[nlnx$ncnnLnunWnnpn,n n8nEooio Ao,*o87oD?oPUo\IohoteotoQoo>oGo;o&oHo!oZo3pVpdp4 @D# @VoV @Vk@ , @  "@|@V`@Va㿐@/V/V  `    㿐㿀#cD 6Y#X@ْ @V@cDcD@Ӓ ?#Yc@͒   G(c `@ @V*@  @? "@@V  $ `"` * $㿐` `*?@   'Y @㐠 ,"@  `  >@U   L  ,` 'Y >@Ò㘠  ,J? :&@&@ $@`@ * `"$`@` &` @UĔ@U㿐!!c@ `     # 2@ `젒! X ?@:   z@ p` * ?@$@ a`` $`@ U`` `"$ @ " @  $ "@   㿐! 2 | X". @ 2 ?@@   ??.    X!@   "    X!@ ֔   㿐1! 2  Xap@U  2 @ ! "@ 㿐` @ Y",@ 2 @@  , !@,Y"@ ` ! Y"@``"@@T̔@*?,Y"@X!h@j @T 2NN  @T 2 @T " @T " @T C"@`@T,@T @  1@ D/Y-Y !@Z㠲@V `" :`  ` N@ ` ",, , ߴ@Tb@@ L   L  <€"@ wHN +Y@TCc ?Y@cȀ ?@T( @  @T# . ?@T ! 2?  耥0,Y"@V!@X! " @S@% @T @9@6'' ''''''''|'t  Y#Ѐ 'D`@ ' 5J `+'쀤`-X`'J@`zG#|,`@&"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""|"$!""""""$""""""""$""$""$#"""""""$#!!!!""|$"!""!"#!!t"\!h$""$"!Ԙ x'u"! r' o' ''t i' f' c' `'|]" &J@ -Y`'T&J `@ '@S"cD =* =@g` 'J Ʋ`0X@ !Y@ #Z" J `@ ' '?'J@?Ѐ  @R `D`D`m`+'"'#" '\J `@ '[@RԒ` [@RΒ`([@ \ 0, @ a@ I" '޶ J `@ c''DJ `@ V'@R@`R`R`a`A 쀤 x[ `i(*@`I"`a`A`x`u`U `X2            @t`R^  ' J     ' @&%@ `#[   @R&% 쀥@[`@ '@R@젒"[` [@  @쀢 [ X@ X% @ +` $ @Q`@ '@QD'L#X"` @Q @Q'TĀ `!   ! @Q֔  "  `!#a $:  * @  a @Q$a $ $@!@ @Q'쀢 $!$ $!$@Q  "`a$?"a$J ?"a$ $@@Q "a@Q#X K@ e   ' 9X 64X 20X ,X ( %!  #D X !!      X!@ ǰ @0$ @ ]"c@$ "   P@ U , @??"` 'Vax@I 'X`P@C 'Xah@= 'ܐVb0@7 'd  2'd ! 2    @䀢  'd!  t Xa@ t Y!#H#H? $#H@P#H ` $` $#H? $#H@P#H ` $` #H?  $#H@P#H  #H!` $` "!#H? $#H@P͐#H ` $` #H?#H#H? $#H@P#H ` $` #H# @ % `@@x6  \@  @O?@O? @O\ &֠\@ 6 @O @OS  @O? % @OI`%*@ @Ol !  x *?Ā  `?d@@d  @ a!  ?'*?  @O%  *@!@ 4 '4 '<4`@O <$ ! ! !!@ 줒"  ?@:  $@ ,  2V!@ @ `"X@NՐ! @@ @ P  V"0@Ғ  @*'Xa@v  "X!@Ē @ P@ `` V` V"@  `` ` ""`@ ` p` @ @ p   V"@ @@Ɛ g c! "@] Y@S`  L@F`쀢 E@?` >@8` 7@N{ '!"!X!h@N `"X@N8! @B@[  @`  @N @NY@N'@,0@ @(!"  x " .59@a 2i  @ ^ 2 V a@  Q!V a@  I!@N @,!(@Mߤ @ "' @N  ,   <. .@0 *@@+`*@T@&`*@@!`*  @*  @MÒ@M  >* *" !@Ҕ@ &! @   #D N!!@ !` @!`@ta>@ ' ?*@@  @? "@@Mr  $@ `"` * $@ M N@  @? "@@MV  $ `"` * $<" `4@MI<@4@!@!@ @ @ `@p      @  !    `Ā @@`  "`t  ##HcH? $cH@McH`$ @` 2  "#<'l! `@  % $ #< 5  '##H+   `?@? "@ @L  %`"`  * %cH? $cH@LƐcH`$ @׀ ."#< +  @? "@@L  $ `"` * $#<cHcH? "cH@L  $#H "  $ $ X@ P[@ Ȑ @ɔ@[@ސ   t@'t l "! " @('쀢 "Ā   @ '[@Ld`@@J  zD@Lw s p  l g? @    ? T @ @L  ? ??'  Y@#h[@c  @  @b  2" @0S@ @~Ā       `?t   J  @M'l@d! / ,! " "!  'D@1L@K|  @($ '   D@! D@L!!  #`! $ $`@ $`$ ! @ $    #1@P#< >0 ` 1 #<  @9#<@ 㿐!!` $ 㿐 J`) `\` `(   J? 㿐  L <  R#N [q* MtMPMPMPMPMPMPMPMPM0M0MPMPMPMPMPMPMPMPMPMPMPMPMPMPMPMPMPMPMPMPMPM0MPMMPMPMPMPMPM$MPMPMPM<MPMMPMPMPMPMPMPMPMPMPMPMPMM<MMPMtMPMMPMPMPMPMPMPMPMPMPMPMPMPMPMPMPMPMPMPMPMPMPMPMPMPMPMPM耤V o`  # 2N`2N(N2=, >, $ @H> <,1, \  \,   , i  ] "  "*@ ,* :  \ N ,  N ,   H 㿐 J  " @"  @ 㿐 @@ !`"@@ $ !  @@G @$ 㿐 @@2 !`"@@ $ `"` * 㿐#  -=702  (*@ 㿐@/E/E ? ???㿐㿠㿠Return-Path:Received:Reply-To:From:Sender:Resent-Reply-To:Resent-From:Resent-Sender:Date:Resent-Date:To:Resent-To:Cc:Resent-Cc:Bcc:Resent-Bcc:Message-ID:Resent-Message-ID:In-Reply-To:References:Keywords:Subject:Comments:Encrypted:Errors-To:Return-Receipt-To:Precedence:Full-Name:Posted-Date:Received-Date:Message:Text:Via:Apparently-To:Apparently-Resent-To:Autoforwarded:Content-Identifier:Conversion:Conversion-With-Loss:Delivery-Date:Discarded-X400-IPMS-Extensions:Discarded-X400-MTS-Extensions:DL-Expansion-History:Deferred-Delivery:Expiry-Date:Importance:Incomplete-Copy:Language:Latest-Delivery-Time:Message-Type:Obsoletes:Original-Encoded-Information-Types:Originator-Return-Address:Priority:Reply-By:Requested-Delivery-Method:Sensitivity:X400-Content-Type:X400-MTS-Identifier:X400-Originator:X400-Received:X400-Recipients:Alternate-Recipient:Pp-Warning:Fcc:Resent:Forwarded:Replied:Article:Path:Summary:Organisation:Organization:Newsgroups:Followup-To:Approved:Lines:Expires:Control:Distribution:Xref:Originator:NNTP-Posting-Host:Submitted-by:Title:Article-I.D.:Posted:Relay-Version:Sent-By:Content-Type:Encoding:Content-MD5:MIME-Version:Content-Transfer-Encoding:Content-ID:Content-Description:Content-Disposition:Accept:Public:Allow:Last-Modified:URI:Version:Derived-From:Content-Language:Cost:WWW-Link:Acknowledge-To:Transport-Options:Default-Options:Content-Length:Reference:Auto-Forwarded-From:Auto-Forward-Count:End-of-Header:Original-From:Original-To:Original-Cc:Original-Auto-Forwarded-From:Original-Date:Not-Delivered-To:Report-Version:Status:Mail-from:Read-Receipt-To:From Article X-Old-X-Loop:<>foo@bar Re:Usage: formail [-bczfrktqY] [-D nnn idcache] [-p prefix] [-l folder] [-xXaAiIuU field] [-R ofield nfield] Or: formail [+nnn] [-nnn] [-bczfrktnedqBY] [-D nnn idcache] [-p prefix] [-m nnn] [-l folder] [-xXaAiIuU field] [-R ofield nfield] -s [prg [arg ...]] Y Y Y Y0Y8Y@YX YhYxY YY YY YY Y YZ Z Z Z0Z@ ZP Z` ZpZ Z Z ZZZZZZ[[ [8 [H[`[p[[[[ [ \\ \(\@ \P \`#\\ \ \\ \]](]@]P]h] ]]] ]]]]] ] ^ ^ ^( ^8^@^P^` ^p^x ^^ ^^ ^^^^ _ _ _ _0_P _`_x_______ __` `` `8`P`` `p```` ` `aaa(a8a@ aPY Y0ZpY8Y@ YX  Yh Z` ]Y ah/bin/sh Folder: Couldn't write to stdout > remote from forwarded by @!/.UUCP> -b don't escape bogus mailbox headers -Y Berkeley format mailbox, disregard Content-Length: -c concatenate continued header-fields -z zap whitespace and empty header-fields -f force formail to pass along any non-mailbox format -r generate an auto-reply header, preserve fields with -i -k on auto-reply keep the body, prevent escaping with -b -t trust the sender for his return address -l folder generate a procmail-compatible log summary -D nnn idcache detect duplicates with an idcache of length nnn -s prg arg split the mail, startup prg for every message +nnn skip the first nnn -nnn output at most nnn messages -n don't serialise splits -e empty lines are optional -d accept digest format -B expect BABYL rmail format -q be quiet -p prefix quotation prefix -m nnn min fields threshold (default 2) for start of message -x field extract contents -X field extract fully -a field add if not present -A field add in any case -i field rename and insert -I field delete and insert -u field first unique -U field last unique -R oldfield newfield rename r+bw+bCouldn't openInvalid field-name:Duplicate key found: field exceeds actual length by bytes , continuing... Failed to execute Can't fork aFile table full formail: "" /dev/nullOut of memory mxpp X Xx  nl 00<0H0T0`0l0x00000000000000 0,080D0P0\0h0t0000000000000~$Date: 1994/10/31 17:30:23 $Z0Z Y YxFILENO=000Stephen R. van den Berg@(#)SunOS 5.5.1 Generic May 1996as: SC4.0 dev 15 Feb 1995 GCC: (GNU) 2.7.2as: SC4.2 dev 30 Nov 1995 GCC: (GNU) 2.7.2as: SC4.2 dev 30 Nov 1995 GCC: (GNU) 2.7.2as: SC4.2 dev 30 Nov 1995 GCC: (GNU) 2.7.2as: SC4.2 dev 30 Nov 1995 GCC: (GNU) 2.7.2as: SC4.2 dev 30 Nov 1995 GCC: (GNU) 2.7.2as: SC4.2 dev 30 Nov 1995 GCC: (GNU) 2.7.2as: SC4.2 dev 30 Nov 1995 GCC: (GNU) 2.7.2as: SC4.0 dev 15 Feb 1995 GCC: (GNU) 2.7.2ld: (SGU) SunOS/ELF (LK-2.0 (S/I) - versioning).interp.hash.dynsym.dynstr.rela.bss.rela.plt.text.init.fini.rodata.got.dynamic.plt.data.ctors.dtors.bss.comment.shstrtab  xxll$ )  3ppD`9XX?XXEXXqMmlml Rmxmx[nn `p0p0fppmpptppypr0707010000ceb8000081a400000064000000640000000132f5119000002914000000200000001b00000000000000000000001300000004reloc/bin/lockfileELF 4%4 (44!!!!! ! /usr/lib/ld.so.1CT40=GMK7D1#*&A<2HEQ.B"6O>:LFSI$%;R9N'!(+3)8 -,/5@?CPJL   x  ! !  ! #x#### tlt%","5#>#CJ"Q! g#mv|"!! $" #dx"""#",!  L("h"#L8h"\"  "#!"#("/"6#<`D"DI#(O#T#Y#`! z0"t !  #4""P#X"8 #@rwritethepid_starthostnametfreestrtolgetpwuid_environ_endrclosegetpid_GLOBAL_OFFSET_TABLE_sleepwriteerrropensignalatexitexitelogmallocuname_initgetuidgetpwnamgetenvuidstrncpy_DYNAMICtmallocstrncmpsetgidchownultoanwritestrpbrkunique_exitsstrstrenvironerrnounlinkstrchrlstatqsignalfreecloseopensgid_edata_PROCEDURE_LINKAGE_TABLE_myrenamestrcpynlog_etext_lib_versionnicegetgidhlinkmainstrlenlinkstat_finifstatlibm.so.1libsocket.so.1libnsl.so.1libc.so.1#!$!%"8"6" '",."8Q"D@"PO"\5"h1"tG"=""*"#"","+""<"L"2#># #B#(A#4K#@S#L3#XP#d( @D# @EmG!@Ei@I, @ "@@E^@E_㿐@/E/E|  `    㿐  ؁?%G@E=$@ @E9` "cc0@E1!$ @   @E)h&@@@E$㿐@E! @E 㿐G!㿐 N@ '"\G ` ""WG $ G 0>"`; J ` { \FG2 BG. Ga@D  G` a@D  .G`N@ & #Ѐ  `_ @DӒ@D@DŐ @, `G!@DL G! G@Da ϶  ?@D "c@D  @D   !C@*  @'  @$  @! ?+;'J@ -``' 'L l" m ?2G h  !".`'G*`? s&` r#`J ?%'@Dd L`l`r G0G"@DL G쀤G0 @H?@D< J@ cJ` Gc܀ `Gc܀ 2%G@D'!Ȁ  %c@D%  @D c @C G%cܒcܔJ l uG0`#c@Dc܀ G#cH J lHH H 0? @C氆?'@C@C  e耢 c؀ c؀  K GH 8HH HH#?`L*`E @4!@Cq` ?" ?@C]쀢 H XH x  H  @CYq쀥? 2?H 5 I@CKb ?H@CD\H% @C ?  G!@CJ HH Hא >*Gڐ#?'H Ѥ EHŐ H ?$J> ?2[ G"0  @ I  I㿐@B "c؁㿐@B㿐@B㿐@B㿐@Bِ㾀#   @Bϐ !$#@Bʐ?٤$#`? _/?-?#).@@@ @`@ݲ@Bq .` @Bh ".@%# `2.@ @B  `"@ < 0@B@B~h "  h@x@@@ c@Bp  @BN  Hav { 㿐@ !#@B7$#@BN !#@B2h  $#|< ( ?  ` ?%?| ?H  @ B?  ; 2 ` @5`   -    "(        @? ` @   ` @Ӓ 0 㺈# @Aސ!@AҐ  $#@A#1H! ? `# =>  -=702  (*@   㿐"#G@Aw` @Ar 0 @Ao#䀢 @㿐@/@/@ ? ???㿐㿠㿠/.locklockfile: LOGNAMEHOMESorry, but turning this mess into a useable mailbox exceeds my humble capacitiesUsage: lockfile -nnn | -r nnn | -l nnn | -s nnn | -! | -ml | -mu | file ... -nnn wait nnn seconds between locking attempts -r nnn make at most nnn retries before giving up on a lock -l nnn set locktimeout to nnn seconds -s nnn suspend nnn seconds after a locktimeout occurred -! invert the exit code of lockfile -ml lock your system mail-spool file -mu unlock your system mail-spool file Can't determine your mailbox, who are you? Can't unlock "" again, already dropped my privileges Out of memorySignal receivedForced unlock denied on "Forcing lock on "" SorryTry prayingTruncating "" and retrying lock Filename too long, giving up on "0! ## x  L !   00<0H0T0`0l0x00000000000000 0,080D0P0\0h0t00000$Date: 1994/10/14 18:43:30 $/usr/mail/$LOGNAMEStephen R. van den Berg@(#)SunOS 5.5.1 Generic May 1996as: SC4.0 dev 15 Feb 1995 GCC: (GNU) 2.7.2as: SC4.2 dev 30 Nov 1995 GCC: (GNU) 2.7.2as: SC4.2 dev 30 Nov 1995 GCC: (GNU) 2.7.2as: SC4.2 dev 30 Nov 1995 GCC: (GNU) 2.7.2as: SC4.2 dev 30 Nov 1995 GCC: (GNU) 2.7.2as: SC4.2 dev 30 Nov 1995 GCC: (GNU) 2.7.2as: SC4.0 dev 15 Feb 1995 GCC: (GNU) 2.7.2ld: (SGU) SunOS/ELF (LK-2.0 (S/I) - versioning).interp.hash.dynsym.dynstr.rela.bss.rela.plt.text.init.fini.rodata.got.dynamic.plt.data.ctors.dtors.bss.comment.shstrtab d LL@  )   3 X9xx?EqM!! R! ! [!! `#x#xPf##m##t##$y#%e0707010000ceb9000081a400000064000000640000000132f511900000150e000000200000001b00000000000000000000001300000004reloc/bin/mailstat#! /bin/sh : &&O='cd .' || exec /bin/sh "$0" $argv:q # we're in a csh, feed myself to sh $O || exec /bin/sh "$0" "$@" # we're in a buggy zsh ################################################################# # mailstat shows mail-arrival statistics # # # # Parses a procmail-generated $LOGFILE and displays # # a summary about the messages delivered to all folders # # (total size, average size, nr of messages). # # Exit code 0 if mail arrived, 1 if no mail arrived. # # # # For help try, "mailstat -h" # # # # Customise to your heart's content, this file is only # # provided as a guideline. # # # # Created by S.R. van den Berg, The Netherlands # # This file can be freely copied for any use. # ################################################################# #$Id: mailstat,v 1.20 1994/05/26 14:11:54 berg Exp $ # This shell script expects the following programs to be in the # PATH (paths given here are the standard locations, your mileage # may vary (if the programs can not be found, extend the PATH or # put their absolute pathnames in here): test=test # /bin/test echo=echo # /bin/echo expr=expr # /bin/expr tty=tty # /bin/tty sed=sed # /bin/sed sort=sort # /bin/sort awk=awk # /usr/bin/awk cat=cat # /bin/cat mv=mv # /bin/mv ls=ls # /bin/ls PATH=/bin:/usr/bin SHELL=/bin/sh # just in case export SHELL PATH umask 077 # we don't allow everyone to read the tmpfiles OLDSUFFIX=.old DEVNULL=/dev/null EX_USAGE=64 ######## # (Concatenated) flags parsing in pure, portable, structured (it # would have been more elegant if gotos were permitted) shellscript # language. For added pleasure: a quick demonstration of the shell's # quoting capabilities :-). ######## while $test $# != 0 -a a"$1" != a-- -a \ \( 0 != `$expr "X$1" : X-.` -o $# != 1 \) do if $expr "X$1" : X-. >$DEVNULL # structured-programming spaghetti then flags="$1"; shift else flags=-h # force help page fi while flags=`$expr "X$flags" : 'X.\(.*\)'`; $test ."$flags" != . do case "$flags" in k*) MSkeeplogfile=1;; l*) MSlong=1;; m*) MSmergerror=1;; o*) MSoldlog=1; MSkeeplogfile=1;; t*) MSterse=1;; s*) MSsilent=1;; h*|\?*) $echo 'Usage: mailstat [-klmots] [logfile]' 1>&2 $echo ' -k keep logfile intact' 1>&2 $echo ' -l long display format' 1>&2 $echo ' -m merge any errors into one line' 1>&2 $echo ' -o use the old logfile' 1>&2 $echo ' -t terse display format' 1>&2 $echo ' -s silent in case of no mail' 1>&2 exit $EX_USAGE;; *) $echo 'Usage: mailstat [-klmots] [logfile]' 1>&2; exit $EX_USAGE;; esac done done $test a"$1" = a-- && shift LOGFILE="$1" case "$LOGFILE" in *$OLDSUFFIX) MSkeeplogfile=1; OLDLOGFILE="$LOGFILE";; *) OLDLOGFILE="$LOGFILE$OLDSUFFIX";; esac if test .$MSoldlog = .1 then LOGFILE="$OLDLOGFILE" fi if $test ."$LOGFILE" != .- -a ."$LOGFILE" != . then if $test ! -s "$LOGFILE" then if $test .$MSsilent = . then if $test -f "$LOGFILE" # split up the following nested backquote then # expression, some shells (NET2) choked on it info=`LANG= LC_TIME= $ls -l "$OLDLOGFILE"` $echo No mail arrived since \ `$expr "X$info" : \ '.*[0-9] \(... .[^ ] .....\) [^ ]'` else $echo "Can't find your LOGFILE=$LOGFILE" fi fi exit 1 fi else if $test ."$LOGFILE" != .- && $tty -s then $echo \ "Most people don't type their own logfiles; but, what do I care?" 1>&2 MSterse=1 fi MSkeeplogfile=1; LOGFILE= fi if $test .$MSkeeplogfile = . then $mv "$LOGFILE" "$OLDLOGFILE"; $cat $DEVNULL >>"$LOGFILE" else OLDLOGFILE="$LOGFILE" fi if $test .$MSterse = . then if $test .$MSlong = .1 then $echo "" $echo " Total Average Number Folder" $echo " ----- ------- ------ ------" else $echo "" $echo " Total Number Folder" $echo " ----- ------ ------" fi fi if $test .$MSlong = .1 then MSlong='"%7d %7d %7d %s\n",total,total/messages,messages,folder' else MSlong='"%7d %7d %s\n",total,messages,folder' fi TMPF=/tmp/maillog.$$ trap "rm -f $TMPF; exit 2" 1 2 3 15 trap "rm -f $TMPF; exit 0" 0 ######## # And now we descend into the wonderful mix of shell-quoting and # portable awk-programming :-) ######## rm -f $TMPF $cat >$TMPF <9KC<E=n6} oTz.0W57'."ZB%FDd8*!%M?-c,(U18Y"6 0qXHILj#h|;`R_Jf3)9b{raPl\S$s]x4=  :V>[v*$N&iw '(,  \ h  0 8<ttTu$$+ 3$:l(? H(N,tUTc  nޠ  w|lޘ ߈  pHD0@ [[p$WHh(X4,DTt0'֌.3<94@4H8O@Wj\8c  kw ~`8x<@!u`\ l@P D@ LHD*X1Z47= BIQ8XD]cpknLu,}h<XL  X  DDP` 4޸   l L$(d,/5h@ FTPUd],e(  ovX}SLS(X ttX\`d\h( 8  xHp,0@@'U-X(3  <h ElNUް ]Ԁe<ko hr zt  ptx@$H,hh(T@'d/6ߘ >HQY$@[(`a\ hPnZ(w`$},000nPP0  \@T(߀ @4 \D(p"`*@h4W9>DwpMXT]hkp,<{4Y$  |\HXj8\t  #x)5^0>D0ILSZLaftTmqY x 8h $VP_-&  Zd!T(.59sAHPHS`Xa(h,sx<~Yd\LP 4n8LV<|8 4    @rwritethepidsocketunlockxcreatdidchdloclockskiprccstrunexpeofpwait_startscreenmailboxlastfolderlockfilereadhostnameshellconflictingnextrcfileconditionstfreestrenstrlgnamestrnIcmpwaitforsetuidverboffstrtolgetpwuidgetblshutdescsgetcStdfilledretvl2rdup_environopnlog_endargv0rclosercstatelckingmemmovestodrcfiledevnulllogabstractgetpidforkstrenvvarbregexeclasttell_iobfdlockreaddir_GLOBAL_OFFSET_TABLE_setregidfilledhomesleeppipebuf2bregcompreaddynwriteerrexectrapropenpipwgethostbynameconcondetabmkdirpmrcsignalgeteuidatexitexitalarmapp_valretStdoutskippedopenlogpipthroughthebodyeloglockfmallochostpowsrequeueunamenewdynstringopendirenoughprivsthemail_initreadparsebinshsuspendoquotesputenvconcatenateduplogqnlumaskendservent.uremasgnlastftimeegrepintstrdupprocmailngetuidcumaskpushrcsetmaildireqFrom_ungetbcatlimgetpwnamgargvgloblockfclosegetenvuidgetservbynameignwerrsetbufdoumasktestwhilstwforwaitdumpwaitpidstrncpyoffguardpoprctestbexitcode_DYNAMICpidchildrenamenewlinetmallocrreadlockitmaildirstrncmpchderrreaderrAll_argschdirrawnonlTmnate__iobtreallocsetgidchownexecvonguardasenvcpyultoansforkctimestrcatfindtstampberkeleyreadmailwritereallocstrpbrksendtoorgmaillastscorefromprogskipspaceasenvunique_exitskpspacenewidforkerrwritefoldersstrstryellrpipepostStdoutlinebufenvironcquoteerrnoalphanumunlinkzombiecollectslogstrgetgrgidTerminatestrchrgetegidtgetenvlstatqsignalmetaparsegetbfreeclosefdunlocksetdefclosedirsetlastfolderopenignoretermopenasgidsetreuidtolockshexecstrcmpsgetcpcatlogopened_edata_PROCEDURE_LINKAGE_TABLE_defdeflockinitgroupsprogerrsbounceltstrsterminaterenvintexecutingfcntlaccspooldirmyrenamelastdirseplexitcodeexecvpstrcpynlogssleepbuf_etext_lib_versionkillalrmtimecloselogsavstdouterrwwritingftimeouttoutflagsavepassniceendpwentgetgidcloserchlinksetxitmaindirsepsyslogultstr.udivinittmoutduprcschmodgobenvgidlcllockstrlenstrcspnrclinkcrestargverbonresettmoutstatslosegetllineshlseekinitdefenvendhostent_finirestargvprimeStdoutStdouttruncatebopenfstatincnamedsetidspmrc2bufnextexitpipintofileendgrentsqueezeretvallibm.so.1libsocket.so.1libnsl.so.1libc.so.1088`DaP\hft!_<^(4@?LXdp|(0"., $0<5HT`$lMxjqK\3k  D,8DYP.\h~t1mbEQ{#P}o @D# @rw @r@,(, @ 0"@,@q@q㿐@/q/q  `    㿐㿐 0  @ b" 0 @Ӷ @q'''' !w#( @qɔ  @+"`<#(@qÔ ' K!#w L - L v8y* 1111111111111111111111111111111111111111111111x11111111111111111011111111111111111111111110h111111101110101011110P10\0D1010t1/w@X#x@U x@R!x@O!(x@L!8w@I"x@F!Pw@C!(w@@" @<a@x@9!hx@6"ݰ @ X' U' R'O"# KK"`@L . F y >@!@; L  .     T" T" 4'"#y@!P# L   .  2& w@Ӑ"0  L " y@Ȑ!h@@ܐa@y@ِ! . 2L w@"0 `'` "'#  w@#y@!w@!@ w@p#'`-"0y!! "%$@px@@@pi 2  L =@J? _2 $2@`@ $@pX#'t'''@pUȒ$bd@ @pP'| 4"cy!! .tbd *`@  @p=  2@p6# "'|y!! "'| @p%  2'|@p!!w@)\ ?@( "c@p"@) @("  @" wcwh@p" H"@p  %#@'`P$!@'`P$"D @p  @p @!e@ @o  e@)`  @) X @) X e@)`< l@oc bd@ Z䀧`@J@  #""@  N -N`?%'l#%|` @o | '||`2'l`" 'l  w@"x 'l%# P, @ol@o}@'w$bP $L"א @o '!"Dy"0 "0*@ *` *`@oĒ@o"D@o^"D|`` @! "P@(i `"PJ   !`["P P @(V `R@"P L,@oX 2+`P "P@(A "P*"P@oH `P"P$.$@, "P$ $@`|`  w@"x !"P @"P"  `  @  "b@`> L!"P@n"P` $%*"Pw@nal$@nbD "Pw@na@nl@nbDy@nڒb(@n!"P@nbD"P*@ @ <!#L " M? ` - M 2 .  . @& $"lw@ c( @,"l  @$`D $"l@_ .  2 .  2̦.  ""\ !@n!y@W"8@ wc"8@n_ Ct @ w@B"xr@`" 0`" 0y"H"``]`!y@'"P By"` 8@n  O 8 #w!w bh@n    "@n-M )@n4"訒2 `2!#y`2#y 8@n)8 2#ytT@X  L<  @yT  #y@ސbx!@  8 wcbx@m 8'``@m `"3` @`+ "c "bdJ@  #w#@w#P@ t`@mc@m J@ ww"w@"0w#@cw#Py@bw"w@b@@m` w@%@%@%w#w@a(``)@&w@v#Xz@ ?#|@ <"@%y"" )'#%VD%#@my c@# @ &c 2D!  "c#cV`@ @c$ w@m*#c@mY@mQ @mT !@c$#"# "c` w@ w@ #!@m ̀ @%T w#`$ @&M ?`/.  +%! '!@q @ `. $\$4#*`  4# $#* @ # '<@.  '<'8'@! 0 @U w! @ 0"4 " 'T""$" 0@ H  @q#@  w"8@  "D@W"8@lw"! 8@lJ@ 2`2   8J@ . @lJ`  #@6@&^*!#@l`8`#@l "4  Ā!"@@#䀢 `` " A!w@"p"L%  b$@ | !@"D`0@"D  #x@  |*x`"x*@V#Ѐ I"D*#M`6 +1/`>2-MM >2)M@4 bDy@jc8@j˔bD* @#bD%V#`@k bD@j##@j@"֐`Ѩ "DJ y@#H@#@ 2b( ! "b(!@)# "bTJ!+ *"P"@ #@A G #@6 <"P$"b@  @+"H-`?   #@ "@ #@ J!,   @(? y@#xjJ!+`" *!+w@"Hy@&#w@#"X@#䨒"!@! 2 @ =  =- @- 2 @@ ! |``@I#0#@j #䀥`@ {  {- -@ڐ  @Ր  @А y  w@"Hy@א#w@Ԑ"X8@HT@E\` b$ "b$  @ `b( !w "b( !w@V#(J!, y#@w#(@@! "bl!" "!@!$" !"` @!$"`@i@@ws'd@"lw@c( !f "( @"l "(   w@#( ""lb$ K"b$`b$ "b$Uc@ `A`"P"@"D@i^c䀦 !@@##@iN  #@ "h J!,   @ "@!aJ!,   2'dz@n#@ <'d?P"b<b$@ } 8y'8@* @'\'8* @'T@#b$ "3?/"b$!@q#䨒 #J@ @ @ #@@Ґ =   =- Uc@  -"$ 2@#@-? H @? @  @ @ @ T   M . @h"dw@hb y@hc؀ @"``@h{#䀢 #@ b  P@@ a 2  w@Ő#L @h\   P@@ H 2  "" @@-" @㿐wa@h+ `?N -@hhh  |<   !4`" !4"@!@!@!@@a<!@@`H@ @ ͐@I㿐 !@! H` @  $ H!< d@h9 !@ @?!H, @ @` @  6 y@ ې#@`@g B!H, "@?@㿐! H  @ ?$ H@h "㿐b$ 1"b$y@ #1!@ !@&!@`* "`H&!@*` @g !!8@o$!4!@?&!@`* a4 $!4  㿐!!@#!@ * ?$`H$!@㿐"!8"a4 @   )"`H%w@gN z@ǐ#ТL@`"@g|耢 !"D@g|"D@gs  ,@`@gs"D @ H㿐@? 2..@  㿐1%!48@#`H @gj "aa #Ѐ  "D@`M`"`` @`* z@ !(@L0b 㿐b8 "b8 )@`c܀ 2z?@`vcz!@@@`j z@!P@'"4 ?@``c 2&@2&@K?@Ɛ"@Ґ @`:@ؘ  @`h&O@ 㿐 z@!`# J'!l%@ 4l4`$` @_ $` @_ "a8 $8 @`  @`  #Ȁ     4l @_l" \8 ?$8 "z@s!x@ d# 㿐! \ a@_  \ @_Ҕ  2l \ @_ǔl?$ \?㿐"P&@ !#%!z#,    !@U a $a,  "  㿐?""< "c    @_Q G z@!"!   "t  @_6 "b<"t    ??`@ @     #@" % & @ "t  2#!  N N  !`"!wb@” #""t   - "z@!"#@"  ? H @^#䠒@^  @^ @J " 0@^'@$#'%)` `D@^ #Ȁ "`` z!@ c䀤 #z6?@^"D,#bD@^k`!#@^K`@^L @p`z!@#bD@^#䀢 z@!@D#?"D@^c䀢 ?@#??䀠 wJ?H耠2  J.2 *?   ""TN |2`"x@ @X@#Ѱ"X8 "`#䀦 @]#L @] ?@]h  |`|@^7`|<   `0#@^-! ``!@ܐ@Ԑ!w"@]c䀠` $ @*#bx"  @z@]@$bx w, ",?"D@]c ?w@]b"D@]c ?#bD@] bD!b Kڒ F`EbD@]wc"x@<#+w bc@]lcL @]_ ?8@]ph c@]!  |`c@]`,,?@]<b  N  "xc䀦`@T㿐 1 20 #Ȁ  12z!z"@@#@#"<`& @]k 2 #؀ z z@ѐ"8  㿐  #؀  w s! H%"LJ*Pp P@\ʒ ","L@"Pw@" ,bL*"8 'zbLz"h"@ ? J@ 2`$ `N8 N!#@\*#z@"x@#w@"z@"X!#@\ǔ =@\\ #* =#@u#䀤`` ?!z@m"``G! a#@b#w@_"Ḁ  ` !*`P`(㿐%z#!@v "Pa@& x 4"!'@  @ ڒb@""b@쀦@ #!"P#@"@ $"PbL"@ $bL#bP!bL@\"@bP@\@9"@@$"@bP@`$bP! "@  "!!"L"P"@'@ b@$"P"P"L"@@*@L L "LJ @ L C"L"! "a!1%"L@[В $"L`$"LJ` " P4"L   "L0P`"L!@'" "L $"L""L#$a# !"L"Pz" " @ " "P$$a"P "L"!!"LJ*="L*"L"P8!`@"P "L" b@`"@@ J? "?   9 L  `  , ,`*  , $ ؐJ?؀ 2 "Pa@[H"L "a㿐z@[Tb瀢 N` @ N` :2N` :2  N@  ` 2``㿐@Zߐ+ (!!Ā !@[e@[d "!'Đ@Z$Đ@J?   @$@[0!!Ā# @a$! @ZaȀ @ǔ㿐 @Z  @Z  @Z  @Z 㿐@#@[!㿐"4 !#@Z? "!@[#!"d@[?@Z"d?@Zc "b4" 㿐w@f#h@㿐? z@[#@ 㿀z@R# c{` @t㿐{@@ @l㿐{@8 @d㿐"  b@c㿐 "  c@`㿐 @@E㿐@Z"b"!㿐? @Z @ ?㿀)w#('{0  #a@Z  a{ 8$a bs{ @@Y#(0㿐w#w# 㿐N { H㿐"\  #%b\ $b\@Yђ = $8"\   8 8㿐b8 ?"b8 w"@4㿐"l @Z& ` ! "` {z "8  ?<  ww#8 4  "`{ P*`|@wy"@x D`"!" @@Yb z @" ?"b<! 2 {K{{    z@#c @YJ @ '*ܐ  'ܐ?@ z#h܀ " J   7{`@Y0 L@Yܔ 2 @Y7@@Y @YL { @Y+ ܀27{@Y` 2 @Y@Y7ww@<#{@%`"<`& {! X"D@"D{@!"< !w"@XL  z@#@@"@  @Y_ !@X## @YW @{!}# "8 @   "` v" s"` z#h!  @ @X`㿐@ t㿐 @2  2 @[ &  `&  @}*`&  & * "@?Ѐ   ?? _ 㿐w""c!#V` #㿐 "b!"Dz@XWcА  =* @XQ"D㿐 K"`@㿐 "a㿐 I"`@P J@` " *@ *@ `*@㿐"D"c@X{@Xa @X!#V` #㿐!@X`@ $ #@W0 "##V` x"*? J *?x2J*?*㿐#@WӒ@WȒ㿐@W @@WÔ㿐@W z#h㿐@㿐bT "bT@Ww@r z@Wc =,  @WM@㿐?  ?Ѐ ( . .3   2..V "` = 4  &  `2 `" 㿐!#@Wf#@W] = "D"cԠ @WXV` #@,? 㿐#{@W!a( ! @   $ P $ P!@V#%@SD#@`P$#@`P$D#z@WcЀ  @W6 0 "b#{@Va0 @_0#{@Va8 0#|@Vܒb  "c#{@Vђax  @#4c" "c*4 "4#{@Vah  @  {!P#{@Va@ ( @ @  "b "` b8 ?"b8@Vh D"wc(  "acٞ#w@Vtb b`0\#{@Vha`  @V @8#{@V[aP 0E#w@VQcX  @@VH 6{! H { " @' `,`@V- 2 @$ ,` ' ,`@V " ,`㿈@VE 쀢RJ  2 '{aĔ  = {aﻔ  {aﴔ  {aﭔ   {a璉   {a  {a  {b   {b     @*(8 "\ "  0      "? 2 ? ޒ`㿐N `?@ N4   @ @ 㿐  @V" `& ` & @& `&  ` & `  @   @   㿐  ,  J@ "?>??, 㿐@U @  `@UB$@&.@@"*#"c@UCh .| ` "d `? "|  "b4$  |@. |$ "cܐ" CQ#@U\!'+#){{"X/-{ @Th 2 bd@` `2xc "X*@@*`*`*`*`*`*`c@Tɒ @S@TҒh #Ȑ @?|  ` @Uc䀢 { b0 {b@Tc䀤 | {@Th s|c< (@"c@2@2 c䀢 cbd@7c "X*@@*`*`*`*`*`*`c@Ti @ x{A"`W{T"hc@Tc䀢   {b0@T?cK{ {b@T7c#|,C{|n@?X@"= B wc@TX|* '|@T) # !   @T(h + k!    @Th  {"   '''''N N  wː#{"{ݐ"K` "K`  w#{ΐ#{ː"̀`'K` K`  K` K` `?'"P'"LĚ"@ 'K` K@ '"@"  '"@'"$ : "$`?K` ` `?K` `2  K`  @ K`   @ " /'|9h̚'L * ̀`[iD D@SV ?D N    .bD:N  ?D |||#D"c ?ߑ* : `;hj *`@||||||||||||||HH,DE?D@GN@ ^2^`4쀢 |b f ?? 6'IQN B`LN@ 2`{c@R  3.@"PN {"L"N B H0"Lb@"# @R~ {#(@Rx b@* 0А@R` * @ @(D@!N \!!@RG!@RC @@@R>"@Rf!̐`@Ra!{c, " {c,'!!̐ '!! !̀  K` ` `@`|aH{@ tHbBi?|;bH?|aM F@bVH? F '?|a@|b ||b;|a@H4|a |b@H)?H9 ?|b ?&@&|aH|b@ |b@ ߐ `? аΰ D "*@ِcV`V c@QDc`c@QD "b(@ c "bhc@۔`3 L /`$ 7H?|b/D|"|b%H ?F ?`H? L `2 D`D D@QEc`cV` c @QQ ED@Q1c䀧`/cJ <`` b@  '':|B| 4b@' ?@Q @@?J <b@` `b@`"   `  @Pc|b||b?|b |b?  Z`(|!Ȣؐ B'|!F'  |a +/ ؀ |!|!s|!`|!D0H'  "c|a "c` |a; 㿐!!$!"##! " @PR   &@P 㿐@P "# "c|&"0"l $ |@P’  2||"@"P.A!А l@P%c㿐c耢 "c@P 㿐!܀ $@P   & "bt!a؀ |"`|" |"( " |֐"`|"@O L㿐 E" L !m@   @   @   @  )㿐@ @@㿀 w#'' 'w"'  " w#w # " L@|"(L@ ` bp 2#   4"(  |bp c "x@ʤ wg# @B, "p#"x,"L@ `@ `@ 4,"` ," @ ,"e 㿀  ?!"!"@ڐ!@ؐ@a b"bl"!8"!@!@!@Ő@ @L "a@ @@@3:@@! @ﻔ  "h  3c J"`L3b( 5qܒ&b(   &b( [@!@N @!@"lw<c( ?     @Ub,"H㿈@M@  "bl@Ȑ@z"l /?N "h  3b( "l b(    ""l ~㿐@@&@@@O @  @?4@"l )#` 2f!! #@+  &@@, # .#$` "b("( "l"bH""l@@`㿀 @@? 6"bl" @@@ @0  "a@@@ @@!e "@bP@f!@M L@"lK -@ $账@  |"@@Ր? 2 ?:N 0"l@""l.㿈# |@Mc" ?`" @N |!"D@Mb` =,@ `@`,"D?N Io !#@# -$bl#q"`@@? ""a|@ $bl@2 @0 bP @@M L@%@ !"l#h#!"lc䀢  "l" @!"" " ` 2*   (  2*   ( (" ! ` 2*   (  2*   ( (" H 㿐! ."  \ $ (  0  \ ^ [뀦 瀦 a "a@  "b a"a  ^`? !!"" " "  !?,  " " ??,  a  "a!`$"` @ ] -` " ]!  " #`  " -! "#) `?a -a ]  !( & a $a! 8%!`$a `  ] "a %    a?$a a a $af!!]"@ ` ^ `Z"!!쀦!!O! !"!  <# > # / 0$#! !! "@a1 a|"$a   ,$a!$&"a?"a !" !  ` ! "!" " " a "aa "aJ)"  |    㿐'%+!)!  %a  h$$0bԐ  %$a +"  * J ?-E  9$! <` $,4! !"` "`$z $   $ $! %` $\ $  0"$O㿐 a! ""a"G"!!! )" |  09\ "!!2 !!"@"`a "a"!F  @ `""!!"b!""b @ `"   a "a!2  "! aa "a㿐"!#!  #!"&!" > ##" 7  #!  200. 2, #&!!&  ! $&͐ @8a  `($&"a`@& &  㿐 ؒ * )%" '$""%#a$"!$ $@ $$@"!  %" !!"@" |"."!!! !!@!!OQ!` Im! #! ! !!##@ !!`  ""`` 2`"  ܔ@#""@!#""@0+" "`'` 0/""@0"`"`"@ :    @ @ `2㿈 " @ '        (`  s#L4`*  `? *  $ϨϜόϼ<@"!`"  "h*`  2 2 `` " ` " " ``"2   (`  ?` t *`@(DѨh$<|0@";E`"  쀣`l@ܠ d@D  /:6*`4`*  ` 2 2`` "` " "   `` '|"ؔ" 2|         `8@*쀣@8'#@!@Hl* @H.@! =* O@ "`ǐ!!", $", @z`",@&@@HyȐ|"/㿐 "` !|D"|Y" |c"@HK1"D P!#  *?*|D#(X#|?#8S"D`@ K G"`@㿐b8 "b8@H  @H[㿐b8 "b8@H |@H b8 ? "b8 ??㿐b8 "b8@Hi |Y@HZ b8 ? "b8 ??r㿐!"8 $"8@G"8 ?$"8㿐#|쿐#H |@Hd?b8  $b8?? F ?b8 ?"b8㿐|자#HN w"@  wcwh@G0 @w @X@s "c؁㿐ސ|#PA! @!㿐 |b8 "b8%@HȀ "  ??b8 ?"b8㿐 |b8 "b8%?@GȀ 2 &  ??& &b8 ?"b8 㿐 |b8 "b8%@Gא Ȁ  ??b8 ?"b8㿐#@GÐcȀ 㿐#@GcȀ 㿐#@GcȀ 㿐@G1#耢  @Fߐ #"@ @G{㿐@G"bX @ B?  ; 2 ` @5`   -    "(        @? ` @   ` @Ӓ 0 㺈" @G@!@FXS  $"@F"1|#X ? `# =>  -=702  (*@   㿐""v@FCcЀ @F> 0 @F;" @㿐!w@FE"耢  㿐@/E/E ? ???㿐㿠㿠From HBDAahbfcwWiEerRcfile:/usr/mail/$LOGNAMEUsage: procmail [-vptoY] [-f fromwhom] [parameter=value | rcfile] ... Or: procmail [-toY] [-f fromwhom] [-a argument] -d recipient ... Or: procmail [-ptY] [-f fromwhom] -m [parameter=value] ... rcfile [arg] ... /etc/procmailrcMissing recipient Extraneous ignored ...Insufficient privileges SHELLLOCKFILE /bin/shUnexpected EOL $HOME/.procmailrc//dev/nullLOGNAMEExecuting "" procmail whilst waiting for HOMEHOSTError while writing to%s "%s"Conflicting ORGMAILprocmail v3.10 1994/10/31 written and created by Stephen R. van den Berg berg@pool.informatik.rwth-aachen.de Submit questions/answers to the procmail-related mailinglist by sending to: procmail@informatik.rwth-aachen.de And of course, subscription and information requests for this list to: procmail-request@informatik.rwth-aachen.de Locking strategies: dotlocking, fcntl(), lockf() Default rcfile: System mailbox: -v display the version number and exit -p preserve (most of) the environment upon startup -t fail softly if mail is undeliverable -f fromwhom (re)generate the leading 'From ' line -o override the leading 'From ' line if necessary -Y Berkeley format mailbox, disregard Content-Length: -a argument will set $1 -d recipient explicit delivery mode -m act as a general purpose mail filter Recipe flag quick reference: H egrep header (default) B egrep body D distinguish case A also execute this recipe if the common condition matched a same as 'A', but only if the previous recipe was successful E else execute this recipe, if the preceding condition didn't match e on error execute this recipe, if the previous recipe failed h deliver header (default) b deliver body (default) f filter i ignore write errors c carbon copy or clone message w wait for a program r raw mode, mail as is W same as 'w', but suppress 'Program failure' messages Missing name Missing argument Unrecognised options:Processing continued options TZ newslistslistnetworkx400mailuucpdaemonroot>From Unknown usernoMissing rcfile /etc/procmailrcs/Denying special privileges for/USER=$LOGNAMEPATH=$HOME/bin:/bin:/usr/ucb:/usr/local/bin:/usr/bin/X11PWDENVIFSSuspicious rcfile #`'");Couldn't determine implicit lockfile fromIncomplete recipe filter-flaglocallockfileForkingClosing brace unexpected |LostMissing closing brace Failed to execute 0testExceeded LINEBUF Bad substitution of?@$AAssigningBypassed lockingLockingForced unlock denied onForcing lock onTruncating and retrying lock Lock failure onlockfile|Deadlock attempted onUnlockingCouldn't unlockAcquiring kernel-lock Reiterating kernel-lock >Kernel-lock failed Kernel-unlock failed Linking toCouldn't make link toQuota exceeded while writingNo space left to finish writingTruncated file to former size Folder: ^Subject:.*$ From ^Content-Length: LOGABSTRACTVERBOSETIMEOUTNORESRETRYSUSPENDLOCKTIMEOUTLOCKSLEEP/usr/lib/sendmailSENDMAIL$ORGMAILDEFAULT-cSHELLFLAGSTRAPCOMSATmsg.MSGPREFIX.lockLOCKEXT&|<>~;?*[SHELLMETASLASTFOLDERMAILDIRFailed forkingProgram failure () ofCouldn't chdir toCouldn't read: [] Skippedp`a kernel-locka file descriptorforkmemoryTerminating prematurely**Requeued****Bounced****Lost**512udp@:Notified comsat:=LINEBUFLOGFILELOGDELIVEREDINCLUDERCUMASKDROPPRIVSSHIFTAssuming identity of the recipient, VERBOSE=off HOST mismatchedaonyteoffnfdRenamed bogus "%s" into "%s"Couldn't rename bogus "%s" into "%s"BOGUS.Renaming bogus mailbox "" intoAutoforwarding mailbox found Enforcing stricter permissions onCouldn't create suppressed else-if-flagalso-if-succeeded-flag??HBBH8(P(^(((Resent-)?(From|Sender)|X-Envelope-From):|>?From )(.*[^(.%@a-z0-9])?(Post(ma(st(er)?|n)|office)|(send)?Mail(er)?|daemon|mmdf|root|n?uucp|smtp|response|serv(ices?|er)|Admin(istrator)?)([^).!:a-z0-9].*)?$[^>])^FROM_MAILER(^((Original-)?(Resent-)?(To|Cc|Bcc)|(X-Envelope|Apparently(-Resent)?)-To):(.*[^a-zA-Z])?)^TO(^(Precedence:.*(junk|bulk|list)|(((Resent-)?(From|Sender)|X-Envelope-From):|>?From )(.*[^(.%@a-z0-9])?(Post(ma?(st(e?r)?|n)|office)|(send)?Mail(er)?|daemon|mmdf|root|n?uucp|smtp|response|LISTSERV|owner|request|bounce|serv(ices?|er)|Admin(istrator)?)([^).!:a-z0-9].*)?$[^>]))^FROM_DAEMONScore: MNo match on !A?EXITCODE,Timeout, terminatingwas waiting forRescue of unfiltered data failed succeeded Excessive output quenched from[^a-zA-Z0-9_]Invalid regexp MatchedOut of memory %s as I tried to allocate %ld bytes buffer 0:buffer 1:Openingh $ . = I   S (' 00<0H0T0`0l0x00000000000000 0,080D0P0\0h0t0000000000000~0{0x(0u40r@0oL0lX0id0fp0c|0`0]0Z0W0T0Q0N0K0H0E0B0? 0<09$06003<00H0-T0*`0'l0$x0!0000000 0 00000  `I`xph`hPH@0  8MATCH=@(#)SunOS 5.5.1 Generic May 1996as: SC4.0 dev 15 Feb 1995 GCC: (GNU) 2.7.2as: SC4.2 dev 30 Nov 1995 GCC: (GNU) 2.7.2as: SC4.2 dev 30 Nov 1995 GCC: (GNU) 2.7.2as: SC4.2 dev 30 Nov 1995 GCC: (GNU) 2.7.2as: SC4.2 dev 30 Nov 1995 GCC: (GNU) 2.7.2as: SC4.2 dev 30 Nov 1995 GCC: (GNU) 2.7.2as: SC4.2 dev 30 Nov 1995 GCC: (GNU) 2.7.2as: SC4.2 dev 30 Nov 1995 GCC: (GNU) 2.7.2as: SC4.2 dev 30 Nov 1995 GCC: (GNU) 2.7.2as: SC4.2 dev 30 Nov 1995 GCC: (GNU) 2.7.2as: SC4.2 dev 30 Nov 1995 GCC: (GNU) 2.7.2as: SC4.2 dev 30 Nov 1995 GCC: (GNU) 2.7.2as: SC4.2 dev 30 Nov 1995 GCC: (GNU) 2.7.2as: SC4.2 dev 30 Nov 1995 GCC: (GNU) 2.7.2as: SC4.2 dev 30 Nov 1995 GCC: (GNU) 2.7.2as: SC4.2 dev 30 Nov 1995 GCC: (GNU) 2.7.2as: SC4.0 dev 15 Feb 1995 GCC: (GNU) 2.7.2ld: (SGU) SunOS/ELF (LK-2.0 (S/I) - versioning).interp.hash.dynsym.dynstr.rela.bss.rela.plt.text.init.fini.rodata.got.dynamic.plt.data.ctors.dtors.bss.comment.shstrtab     S'' )((  3,,9?EYM\\ Rhh[$ `00fmt y Oo0707010001623a000041ed00000064000000640000000232f512fb00000000000000200000001b00000000000000000000000f00000004reloc/examples0707010001623e000081a40000006400000064000000012de4a83f00000284000000200000001b00000000000000000000001b00000004reloc/examples/1procmailrc# Please check if all the paths in PATH are reachable, remove the ones that # are not. PATH=$HOME/bin:/usr/bin:/usr/ucb:/bin:/usr/local/bin:. MAILDIR=$HOME/Mail # You'd better make sure it exists DEFAULT=$MAILDIR/mbox LOGFILE=$MAILDIR/from LOCKFILE=$HOME/.lockmail :0 # Anything from thf * ^From.*thf@somewhere.someplace todd # will go to $MAILDIR/todd :0 # Anything from people at uunet * ^From.*@uunet uunetbox # will go to $MAILDIR/uunetbox :0 # Anything from Henry * ^From.*henry henries # will go to $MAILDIR/henries # Anything that has not been delivered by now will go to $DEFAULT # using LOCKFILE=$DEFAULT$LOCKEXT 0707010001623f000081a40000006400000064000000012de4a5f100000190000000200000001b00000000000000000000001600000004reloc/examples/1rmail#!/bin/sh # # specify the mailbox file you want to read on the command line # MAILDIR=$HOME/Mail cd $MAILDIR LOCKFILE=$HOME/.lockmail if lockfile -! -r1 $LOCKFILE then echo Mail is currently arriving, please wait... while lockfile -! -4 -r2 $LOCKFILE do echo Mail is still arriving... done fi trap "rm -f $LOCKFILE;exit 0" 0 1 2 3 15 # # Call you favourite mailer here. # /usr/ucb/mail -f $* 07070100016240000081a40000006400000064000000012de4a840000007c5000000200000001b00000000000000000000001b00000004reloc/examples/2procmailrc# Please check if all the paths in PATH are reachable, remove the ones that # are not. PATH=$HOME/bin:/usr/bin:/usr/ucb:/bin:/usr/local/bin:. MAILDIR=$HOME/Mail # You'd better make sure it exists DEFAULT=$MAILDIR/mbox # We don't use a global lockfile here now. # Instead we use local lockfiles everywhere. # This allows mail to arrive in all mailboxes # concurrently, or allows you to read one mailbox # while mail arrives in another. # The next recipe will split up Digests into their individual messages. # Don't do this if you use a global lockfile before this recipe (deadlock) :0 * ^Subject:.*Digest |formail +1 -d -s procmail LOGFILE=$MAILDIR/from # Put it here, in order to avoid logging # the arrival of the digest. # An alternative and probably more efficient solution to splitting up a digest # would be (only works for standard format mailbox files though): :0: * ^Subject:.*Other Digest |formail +1 -ds cat >>this_lists_mailbox # Notice the double : in the next recipe, this will cause a lockfile # named "$MAILDIR/todd.lock" to be used if and only if this mail is going # into the file "todd". :0: # Anything from thf * ^From.*thf@somewhere.someplace todd # will go to $MAILDIR/todd # The next recipe will likewise use $MAILDIR/uunetbox.lock as a lock file. :0: # Anything from people at uunet * ^From.*@uunet uunetbox # will go to $MAILDIR/uunetbox # And here the lockfile will be $MAILDIR/henries.lock of course. :0: # Anything from Henry * ^From.*henry henries # will go to $MAILDIR/henries # But you can specify any lockfile you want, like "myfile". The following # recipe will use "$MAILDIR/myfile" as the lock file. :0:myfile # All 'questions' will go to * ^Subject:.*questions toread # $MAILDIR/toread # Anything that has not been delivered by now will go to $DEFAULT # After procmail sees the end of the rcfile, it pretends that it sees a # LOCKFILE=$DEFAULT$LOCKEXT # Therefore $DEFAULT is always locked. 07070100016241000081a40000006400000064000000012de4a5f200000188000000200000001b00000000000000000000001600000004reloc/examples/2rmail#!/bin/sh # # specify the mailbox file you want to read on the command line # MAILDIR=$HOME/Mail cd $MAILDIR LOCKFILE=$1.lock if lockfile -! -r1 $LOCKFILE then echo Mail is currently arriving, please wait... while lockfile -! -4 -r2 $LOCKFILE do echo Mail is still arriving... done fi trap "rm -f $LOCKFILE;exit 0" 0 1 2 3 15 # # Call you favourite mailer here. # /usr/ucb/mail -f $* 07070100016242000081a40000006400000064000000012de4a841000005fd000000200000001b00000000000000000000001b00000004reloc/examples/3procmailrc# Please check if all the paths in PATH are reachable, remove the ones that # are not. PATH=$HOME/bin:/usr/bin:/global/bin:/usr/ucb:/bin:/usr/local/bin: MAILDIR = $HOME/Mail # You'd better make sure it exists DEFAULT = $MAILDIR/mbox LOGFILE = $MAILDIR/from LOCKFILE= $HOME/.lockmail # This will create a local lockfile named todd.lock :0: # *if* the condition matches * ^From.*thf todd LOCKFILE=$MAILDIR/whatever # This will remove the global lockfile # $HOME/.lockmail and the new lockfile # will be $MAILDIR/whatever # The next recipe will # filter out all messages from "at" # jobs and will put them in a terse format # (only the date and the body) in # a file called $MAILDIR/atjunk :0 fh * ^From root * ^Subject: Output from "at" job |egrep "^Date:" # The next recipe will only be used if # the previous one matched :0 A atjunk MAILDIR=$HOME/News # This will change the current directory # The next recipe will create a local lockfile # named $HOME/News/dustbin.lock (*if* the condition # matches), and will feed the body of the message # through `sort` (sorry, couldn't come up with anything # better :-), after which the result will be # appended to $HOME/News/dustbin :0 b: * ^Subject:.*rubbish |sort >>dustbin # The next recipe will use the games directory as a MH # folder (of course you need MH to read the mail then) :0 * ^Subject:.*games games/. # Anything not delivered by now will go to $HOME/Mail/mbox # Using LOCKFILE=$HOME/Mail/mbox.lock 07070100016243000081a40000006400000064000000012de4a5f4000002f5000000200000001b00000000000000000000001600000004reloc/examples/3rmail#!/bin/sh # # specify the mailbox file you want to read on the command line # Use a relative path from your $HOME directory # # For this kind of chaotic procmailrc there is no uniform neat solution # to determine which lockfiles to use. I'll give just one (suboptimal) # solution here. Use your imagination to extend it :-). # MAILDIR=$HOME/Mail cd $HOME # this means all paths are relative to $HOME LOCKFILE=$HOME/.lockmail LOCKFILE2=$HOME/Mail/whatever if lockfile -! -r1 $LOCKFILE $LOCKFILE2 then echo Mail is currently arriving, please wait... while lockfile -! -4 -r2 $LOCKFILE $LOCKFILE2 do echo Mail is still arriving... done fi trap "rm -f $LOCKFILE $LOCKFILE2;exit 0" 0 1 2 3 15 # # Call you favourite mailer here. # /usr/ucb/mail -f $* 07070100016244000081a40000006400000064000000012e8b0ad100002d2a000000200000001b00000000000000000000001800000004reloc/examples/advanced Discusses: 1. One home directory, several machine architectures 2. Procmail as an integrated local mail delivery agent 2a.Special directions for sites with sendmail 2b.Special directions for sites with ZMailer 2c.Special directions for sites with smail 2d.Special directions for sites with SysV /etc/mail/mailsurr 3. Changing the mail spool directory to $HOME for all users 4. Security considerations (when installing procmail suid root) --- 1. One home directory, several machine architectures ------------------------------------------------- For users that have the very same home directory on machines with differing architectures (i.e. you need different executables), and they have to explicitly use (i.e. the system administrator did not arrange, for example, /usr/local/bin/procmail to have exactly the right contents depending on from which machine it is called) two executables of procmail, I have the following suggestion to use as a .forward file (examples are for sparc and sun3 architectures): "|IFS=' ';if /usr/bin/sparc;then exec /home/berg/bin.sun4/procmail;else exec /home/berg/bin.sun3/procmail;fi ||exit 75 #YOUR_USERNAME" or alternatively: "|IFS=' ' && export IFS && exec /home/berg/bin.`/usr/bin/arch`/procmail || exit 75 #YOUR_USERNAME" Please note, in the .forward file there can NOT be any newlines between the doublequotes, i.e. the former example *has* to be typed in as one long line. If, on the other hand, you have to log in to every machine to read mail arrived for you on that machine, a different solution might be more appropriate. If you have sendmail v6.xx and later, you simply create two .forward files. In the .forward file you put: YOUR_LOGIN_NAME@your.favourite.machine And, in a second file named .forward.your.favourite.machine you put: "|exec /usr/local/bin/procmail #YOUR_USERNAME" If you have an older sendmail, you could put something like the following two lines in your .forward file: YOUR_LOGIN_NAME@your.favourite.machine "|IFS=' ';test .`/bin/uname -n` != .your.favourite.machine || exec /usr/local/bin/procmail #YOUR_USERNAME" The leading dots are important. Check what `/bin/uname -n` returns on your.favourite.machine, and substitute that for your.favourite.machine in the sample .forward file. If your system does not have /bin/uname, check if there is a /bin/hostname. With some sendmails, the last suggestion causes you to get a superfluous copy in the system mailfolder. If that is the case, you'll have to change your .forward to something like: "|IFS=' ';if test .`/bin/uname -n` = .your.favourite.machine ; then exec /usr/local/bin/procmail; else exec /usr/lib/sendmail -oi YOUR_LOGIN_NAME@your.favourite.machine; fi" --- 2. Procmail as an integrated local mail delivery agent --------------------------------------------------- Completely integrating procmail in the mail delivery means that mail is delivered as normal, unless a .procmailrc file is present in the home directory of the recipient. This will be completely independent of the fact if a .forward file is present. This will not break anything, it just makes the use of procmail easier because people are not required to start up procmail from within their .forward files. Creation of a .procmailrc file will suffice. The generic way to accomplish this (works with sendmail, smail and any other mail system that uses a local mail delivery program that takes the mail- to-be-delivered on stdin and the recipient(s) on the command line, with or without the "-d" option) is this: Move your current local mail delivery agent (e.g. /bin/mail, /bin/lmail, /usr/lib/mail/mail.local, etc.) out of the way, and create a (symbolic or hard) link from there to procmail, as in "ln /usr/local/bin/procmail /bin/lmail". Beware, however, that if you are using this method, /bin/mail can *only* be used to deliver mail. On many systems /bin/mail has several uses (also to read mail or check for mail). So, it would definitely be preferred if you could edit the invocation of /bin/mail from within your mail transport agent to invoke procmail instead (with appropriate flags, if needed). Special directions detailing this process for some of the more popular MTAs are included in subsections below. In addition to needing root privileges upon startup, on some systems procmail needs to be sgid to daemon or mail. One way to check is by looking at the current mail delivery agent (usually /bin/mail) and to mimic its permissions, owner and group. If you're not quite sure, just type "make recommend" and some suitable recommendations will be made for your particular environment. The same might apply to the "lockfile" program, in order for it to be able to create and unlink lockfiles in the mail spool directory it might need to be sgid to daemon or mail, not to worry however, "lockfile" will not enable users to abuse the sgid/suid-ness. --- 2a.Special directions for sites with sendmail ------------------------------------------ The following lines should take the place of the standard Mlocal definition in your sendmail.cf: Mlocal, P=/usr/local/bin/procmail, F=lsSDFMhPfn, S=10, R=20, A=procmail -a $h -d $u As for the fields "S=10, R=20": if your system uses others or none on the current Mlocal definition, use those instead of "S=10, R=20". To impose a 2MB limit on mails, you could add a `Maxsize=' field like in: Mlocal, P=/usr/local/bin/procmail, F=lsSDFMhPfn, S=10, R=20, M=2000000, A=procmail -a $h -d $u In order to take advantage of the optional meta argument that can be passed to procmail you'd have to change the sendmail.cf file to add a $#local mailer rule to set the $@ host name (which will be substituted for $h in the mailer definition). There is nothing forcing you to do this, but if you do, you'll gain functionality. For example: Make sure that the definition of operators in the sendmail.cf file includes the + sign (simply tack a + to the end of the "Do" definition, unless it already contains one). Now look for ruleset zero (S0), skip to the end of it. There usually is a rule there that takes care of local delivery, something like: R$+ $#local $:$1 local names Don't change that rule, leave it there. But, right BEFORE this rule, create a new one similar to: R$++$* $#local $@$2 $:$1 local argument Depending on the actual contents of your sendmail.cf file, there still might be some other $#local rule(s) you need to precede with a corresponding +-handling rule, e.g. in some files you also find: R$+ < $+ @ $+ > $#local $: $1 Preceed that with: R$+ + $* < $+ @ $+ > $#local $@ $2 $: $1 (The spaces are not significant, the tabs are!) Now, if someone sends mail to fred+pizza@your.domain, procmail will be called to deliver the mail as: procmail -a pizza -d fred In the .procmailrc file, you can now do an assignment like: ARGUMENT=$1 which will expand to ARGUMENT=pizza. Since you are editing the sendmail.cf file now anyway, you might as well setup an extra `procmail' mailer. This Mprocmail can then be used as a general mail filter. For more information, see the EXAMPLES section the procmail(1) man page. N.B. Do NOT create the extra rules mentioned in the EXAMPLES section of the procmail(1) man page, unless you already have an application demanding those. Only create the completely optional Mprocmail mailer. After having edited the sendmail.cf file you'll have to kill (terminate) the running sendmail daemon. Then restart it. It will *not* suffice to send sendmail a SIGHUP. --- 2b.Special directions for sites with ZMailer ----------------------------------------- The following line should be inserted into (or take the place of any previous local definition in) your sm.conf file for the Transport Agent: local sSPfn /usr/local/bin/procmail procmail -a $h -d $u --- 2c.Special directions for sites with smail --------------------------------------- For smail 2.x users there are two options: i. Move the current local-mail-delivery program (probably /bin/lmail) out of the way, make a symbolic or hard link from procmail to the name of that program (e.g. "ln /usr/local/bin/procmail /bin/lmail") ii.Make sure the following macro is defined in src/defs.h: #define LMAIL(frm,sys) "/usr/local/bin/procmail -d" For smail 3.x users there are also two options: i. The same solution as for smail 2.x (however, method ii is preferred) ii.Replace any existing "local"-entry in the /usr/lib/smail/transports file (create one, if need be) with the following two lines: local: return_path, local, from, driver=pipe; user=root, cmd="/usr/local/bin/procmail -d $($user$)" --- 2d.Special directions for sites with SysV /etc/mail/mailsurr --------------------------------------------------------- Some systems use a SysV /bin/mail that supports mailsurr. To interface procmail with mailsurr the following two lines should be inserted in the /etc/mail/mailsurr file (preferably at the bottom): '(.+)' '([^@!]+)' '$DEVNULL # structured-programming spaghetti then flags="$1"; shift else flags=-h # force help page fi while flags=`$expr "X$flags" : 'X.\(.*\)'`; $test ."$flags" != . do case "$flags" in k*) MSkeeplogfile=1;; l*) MSlong=1;; m*) MSmergerror=1;; o*) MSoldlog=1; MSkeeplogfile=1;; t*) MSterse=1;; s*) MSsilent=1;; h*|\?*) $echo 'Usage: mailstat [-klmots] [logfile]' 1>&2 $echo ' -k keep logfile intact' 1>&2 $echo ' -l long display format' 1>&2 $echo ' -m merge any errors into one line' 1>&2 $echo ' -o use the old logfile' 1>&2 $echo ' -t terse display format' 1>&2 $echo ' -s silent in case of no mail' 1>&2 exit $EX_USAGE;; *) $echo 'Usage: mailstat [-klmots] [logfile]' 1>&2; exit $EX_USAGE;; esac done done $test a"$1" = a-- && shift LOGFILE="$1" case "$LOGFILE" in *$OLDSUFFIX) MSkeeplogfile=1; OLDLOGFILE="$LOGFILE";; *) OLDLOGFILE="$LOGFILE$OLDSUFFIX";; esac if test .$MSoldlog = .1 then LOGFILE="$OLDLOGFILE" fi if $test ."$LOGFILE" != .- -a ."$LOGFILE" != . then if $test ! -s "$LOGFILE" then if $test .$MSsilent = . then if $test -f "$LOGFILE" # split up the following nested backquote then # expression, some shells (NET2) choked on it info=`LANG= LC_TIME= $ls -l "$OLDLOGFILE"` $echo No mail arrived since \ `$expr "X$info" : \ '.*[0-9] \(... .[^ ] .....\) [^ ]'` else $echo "Can't find your LOGFILE=$LOGFILE" fi fi exit 1 fi else if $test ."$LOGFILE" != .- && $tty -s then $echo \ "Most people don't type their own logfiles; but, what do I care?" 1>&2 MSterse=1 fi MSkeeplogfile=1; LOGFILE= fi if $test .$MSkeeplogfile = . then $mv "$LOGFILE" "$OLDLOGFILE"; $cat $DEVNULL >>"$LOGFILE" else OLDLOGFILE="$LOGFILE" fi if $test .$MSterse = . then if $test .$MSlong = .1 then $echo "" $echo " Total Average Number Folder" $echo " ----- ------- ------ ------" else $echo "" $echo " Total Number Folder" $echo " ----- ------ ------" fi fi if $test .$MSlong = .1 then MSlong='"%7d %7d %7d %s\n",total,total/messages,messages,folder' else MSlong='"%7d %7d %s\n",total,messages,folder' fi TMPF=/tmp/maillog.$$ trap "rm -f $TMPF; exit 2" 1 2 3 15 trap "rm -f $TMPF; exit 0" 0 ######## # And now we descend into the wonderful mix of shell-quoting and # portable awk-programming :-) ######## rm -f $TMPF $cat >$TMPF <'. .SH OPTIONS .TP 0.5i .B \-b Don't escape any bogus mailbox headers (i.e. lines starting with `From '). .TP .I "\fB\-p\fP prefix" Define a different quotation prefix. If unspecified it defaults to `>'. .TP .B \-Y Assume traditional Berkeley mailbox format, ignoring any .B Content-Length: fields. .TP .B \-c Concatenate continued fields in the header. Might be convenient when postprocessing mail with standard (line oriented) text utilities. .TP .B \-z Ensure a space exists between field name and content. Zap fields which contain only a space. Zap leading and trailing whitespace on fields extracted with .BR \-x . .TP .B \-f Force formail to simply pass along any non-mailbox format (i.e. don't generate a `From ' line as the first line). .TP .B \-r Generate an auto-reply header. This will normally throw away all the existing fields (except X-Loop:) in the original message, fields you wish to preserve need to be named using the .B \-i option. If you use this option in conjunction with .BR \-k , you can prevent the body from being `escaped' by also specifying .BR \-b . .TP .B \-k When generating the auto-reply header or when extracting fields, keep the body as well. .TP .B \-t Trust the sender to have used a valid return address in his header. This option will be most useful when generating auto-reply headers from news articles. If this option is not turned on, formail tends to favour machine-generated addresses in the header. .TP .B \-s The input will be split up into separate mail messages, and piped into a program one by one (a new program is started for every part). .B \-s has to be the last option specified, the first argument following it is expected to be the name of a program, any other arguments will be passed along to it. If you omit the program, then formail will simply concatenate the splitted mails on stdout again. See .BR FILENO . .TP .B \-n Tell formail not to wait for every program to finish before starting the next (causes splits to be processed in parallel). .TP .B \-e Do not require empty lines to be preceding the header of a new message (i.e. the messages could start on every line). .TP .B \-d Tell formail that the messages it is supposed to split need not be in strict mailbox format (i.e. allows you to split digests/articles or non-standard mailbox formats). This disables recognition of the .B Content-Length: field. .TP .B \-B Makes formail assume that it is splitting up a BABYL rmail file. .TP .I "\fB\-m\fP minfields" Allows you to specify the number of consecutive fields formail needs to find before it decides it found the start of a new message, it defaults to 2. .TP .B \-q Tells formail to (still detect but) be quiet about write errors, duplicate messages and mismatched .B Content-Length: fields. This option is on by default, to make it display the messages use .BR \-q\- . .TP .I "\fB\-D\fP maxlen idcache" Formail will detect if the Message-ID of the current message has already been seen using an .I idcache file of approximately .I maxlen size. If not splitting, it will return success if a duplicate has been found. If splitting, it will not output duplicate messages. If used in conjunction with .BR \-r , formail will look at the .I mail address of the sender .I instead at the Message-ID. .TP .I "\fB\-x\fP headerfield" Extract the contents of this .I headerfield from the header, display it as a single line. .TP .I "\fB\-X\fP headerfield" Same as .BR \-x , but also preserves the field name. .TP .I "\fB\-a\fP headerfield" Append a custom .I headerfield onto the header; but only if a similar field does not exist yet. If you specify either one of the field names .B Message-ID: or .B Resent-Message-ID: with no field contents, then formail will generate a unique message-ID for you. .TP .I "\fB\-A\fP headerfield" Append a custom .I headerfield onto the header in any case. .TP .I "\fB\-i\fP headerfield" Same as .BR \-A , except that any existing similar fields are renamed by prepending an ``Old-'' prefix. If .I headerfield consists only of a field-name, it will not be appended. .TP .I "\fB\-I\fP headerfield" Same as .BR \-i , except that any existing similar fields are simply removed. If .I headerfield consists only of a field-name, it effectively deletes the field. .TP .I "\fB\-u\fP headerfield" Make the first occurrence of this field unique, and thus delete all subsequent occurrences of it. .TP .I "\fB\-U\fP headerfield" Make the last occurrence of this field unique, and thus delete all preceding occurrences of it. .TP .I "\fB\-R\fP oldfield newfield" Renames all occurrences of the fieldname .I oldfield into .IR newfield . .TP .I "\fB\+\fPskip" Skip the first .I skip messages while splitting. .TP .I "\fB\-\fPtotal" Output at most .I total messages while splitting. .SH ENVIRONMENT .TP .5i .B FILENO While splitting, formail assigns the message number currently being output to this variable. By presetting FILENO, you can change the initial message number being used and the width of the zero-padded output. If FILENO is unset it will default to 000. If FILENO is non-empty and does not contain a number, FILENO generation is disabled. .SH EXAMPLES To split up a digest one usually uses: .RS formail +1 \-ds >>the_mailbox_of_your_choice .RE or .RS formail +1 \-ds procmail .RE .PP To remove all Received: fields from the header: .RS formail \-I Received: .RE .PP To remove all fields except From: and Subject: from the header: .RS formail \-k \-X From: \-X Subject: .RE .PP To supersede the Reply-To: field in a header you could use: .RS formail \-i "Reply-To: foo@bar" .RE .PP To convert a non-standard mailbox file into a standard mailbox file you can use: .RS formail \-ds >new_mailbox .RE .PP Or, if you have a very tolerant mailer: .RS formail \-a Date: \-ds >new_mailbox .RE .PP To extract the header from a message: .RS formail \-X "" .RE or .RS sed \-e '/^$/ q' .RE .PP To extract the body from a message: .RS formail \-I "" .RE or .RS sed \-e '1,/^$/ d' .RE .SH "SEE ALSO" .na .nh .BR mail (1), .BR binmail (1), .BR sendmail (8), .BR procmail (1), .BR sed (1), .BR sh (1) .hy .ad .SH DIAGNOSTICS .TP 2.3i Can't fork Too many processes on this machine. .TP Content-Length: field exceeds actual length by nnn bytes The Content-Length: field in the header specified a length that was longer than the actual body. This causes this message to absorb a number of subsequent messages following it in the same mailbox. .TP Couldn't write to stdout The program that formail was trying to pipe into didn't accept all the data formail sent to it; this diagnostic can be suppressed by the .B \-q option. .TP Duplicate key found: x The Message-ID or sender x in this message was found in the idcache; this diagnostic can be suppressed by the .B \-q option. .TP Failed to execute "x" Program not in path, or not executable. .TP File table full Too many open files on this machine. .TP Invalid field-name: "x" The specified field-name "x" contains control characters, or cannot be a partial field-name for this option. .SH WARNINGS You can save yourself and others a lot of grief if you try to avoid using this autoreply feature on mails coming through mailinglists. Depending on the format of the incoming mail (which in turn depends on both the original sender's mail agent and the mailinglist setup) formail could decide to generate an autoreply header that replies to the list. .SH BUGS When formail has to generate a leading `From ' line it normally will contain the current date. If formail is given the option `\-a Date:', it will use the date from the `Date:' field in the header (if present). However, since formail copies it verbatim, the format will differ from that expected by most mail readers. .PP If formail is instructed to delete or rename the leading `From ' line, it will not automatically regenerate it as usual. To force formail to regenerate it in this case, include \fB\-a 'From '\fP. .PP If formail is not called as the first program in a pipe and it is told to split up the input in several messages, then formail will not terminate until the program it receives the input from terminates itself. .SH MISCELLANEOUS Formail is eight-bit clean. .PP When formail has to determine the sender's address, every RFC 822 conforming mail address is allowed. Formail will always strip down the address to its minimal form (deleting excessive comments and whitespace). .PP The regular expression that is used to find `real' postmarks is: .RS "\en\enFrom [\et ]*[^\et\en ]+[\et ]+[^\en\et ]" .RE .PP If a .B Content-Length: field is found in a header, formail will copy the number of specified bytes in the body verbatim before resuming the regular scanning for message boundaries (except when splitting digests or Berkeley mailbox format is assumed). .SH NOTES Calling up formail with the \-h or \-? options will cause it to display a command-line help page. .Sh SOURCE This program is part of the .I procmail mail-processing-package (v3.10 1994/10/31) available at your nearest USENET comp.sources.misc archive, or at ftp.informatik.rwth-aachen.de as .BR pub/packages/procmail/procmail.tar.gz . .Sh MAILINGLIST There exists a mailinglist for questions relating to any program in the procmail package: .RS procmail@informatik.rwth-aachen.de .RS for submitting questions/answers. .RE procmail-request@informatik.rwth-aachen.de .RS for subscription requests. .RE .RE .Sh AUTHOR Stephen R. van den Berg at RWTH-Aachen, Germany .Rs berg@pool.informatik.rwth-aachen.de .\" @MY_ALT_MAIL_ADDR@ .Re .\".if n .pl -(\n(.tu-1i) 07070100002c81000081a400000064000000640000000132f511b7000017c5000000200000001b00000000000000000000001a00000004reloc/man/man1/lockfile.1.\"if n .pl +(135i-\n(.pu) .de Id .ds Rv \\$3 .ds Dt \\$4 .. .Id $Id: lockfile.man,v 1.12 1994/08/04 17:05:05 berg Exp $ .TH LOCKFILE 1 \*(Dt BuGless .rn SH Sh .de SH .br .ne 11 .Sh "\\$1" .. .rn SS Ss .de SS .br .ne 10 .Ss "\\$1" .. .rn TP Tp .de TP .br .ne 9 .Tp \\$1 .. .rn RS Rs .de RS .na .nf .Rs .. .rn RE Re .de RE .Re .fi .ad .. .de Sx .PP .ne \\$1 .RS .. .de Ex .RE .PP .. .na .SH NAME lockfile \- conditional semaphore-file creator .SH SYNOPSIS .B lockfile .I "\fB\-\fPsleeptime" | .I "\fB\-r \fPretries" | .if n .ti +0.5i .I "\fB\-l \fPlocktimeout" | .I "\fB\-s \fPsuspend" | .B "\-!" | .B "\-ml" | .B "\-mu" | .I filename \&.\|.\|. .ad .SH DESCRIPTION .B lockfile can be used to create one or more .I semaphore .IR files . If lockfile can't create all the specified files (in the specified order), it waits .I sleeptime (defaults to 8) seconds and retries the last file that didn't succeed. You can specify the number of .I retries to do until failure is returned. If the number of .I retries is \-1 (default, i.e. .BR \-r\-1 ) lockfile will retry forever. .PP If the number of .I retries expires before all files have been created, lockfile returns failure and removes all the files it created up till that point. .PP The return value of lockfile can be easily inverted by specifying .B \-! as an argument (comes in handy in shell scripts). .PP All flags can be specified anywhere on the command line, they will be processed when encountered. The command line is simply parsed from left to right. .PP All files created by lockfile will have access permission 0, and therefore will have to be removed with .B rm .BR \-f . .PP If you specify a .I locktimeout then a lockfile will be removed by force after locktimeout seconds have passed since the lockfile was last modified/created (most probably by some other program that unexpectedly died a long time ago, and hence could not clean up any leftover lockfiles). Lockfile is clock skew immune. After a lockfile has been removed by force, a suspension of .I suspend seconds (defaults to 16) is taken into account, in order to prevent the inadvertent immediate removal of any newly created lockfile by another program (compare .BR SUSPEND in .BR procmail (1)). .SS "Mailbox locks" If the permissions on the system mail spool directory allow it, or if lockfile is suitably setgid, it will be able to lock and unlock your system mailbox by using the options .B "\-ml" and .B "\-mu" respectively. .SH EXAMPLES Suppose you want to make sure that access to the file "important" is serialised, i.e. no more than one program or shell script should be allowed to access it. For simplicity's sake, let's suppose that it is a shell script. In this case you could solve it like this: .RS \&.\|.\|. lockfile important.lock \&.\|.\|. access_"important"_to_your_hearts_content \&.\|.\|. rm \-f important.lock \&.\|.\|. .RE Now if all the scripts that access "important" follow this guideline, you will be assured that at most one script will be executing between the `lockfile' and the `rm' commands. .SH ENVIRONMENT .TP 2.3i .B LOGNAME used as a hint to determine the invoker's loginname .SH FILES .TP 2.3i .B /etc/passwd to verify and/or correct the invoker's loginname (and to find out his HOME directory, if needed) .TP .B /usr/mail/$LOGNAME.lock lockfile for the system mailbox, the environment variables present in here will not be taken from the environment, but will be determined by looking in /etc/passwd .SH "SEE ALSO" .na .nh .BR rm (1), .BR mail (1), .BR binmail (1), .BR sendmail (8), .BR procmail (1) .hy .ad .SH DIAGNOSTICS .TP 2.3i Filename too long, .\|.\|. Use shorter filenames. .TP Forced unlock denied on "x" No write permission in the directory where lockfile "x" resides, or more than one lockfile trying to force a lock at exactly the same time. .TP Forcing lock on "x" Lockfile "x" is going to be removed by force because of a timeout (compare .BR LOCKTIMEOUT in .BR procmail (1)). .TP Out of memory, .\|.\|. The system is out of swap space. .TP Signal received, .\|.\|. Lockfile will remove anything it created till now and terminate. .TP Sorry, .\|.\|. The .I retries limit has been reached. .TP Truncating "x" and retrying lock "x" does not seem to be a valid filename. .TP Try praying, .\|.\|. Missing subdirectories or insufficient privileges. .SH BUGS Definitely less than one. .SH MISCELLANEOUS Lockfile is NFS-resistant and eight-bit clean. .SH NOTES Calling up lockfile with the \-h or \-? options will cause it to display a command-line help page. .PP Multiple .B \-! flags will toggle the return status. .PP Since flags can occur anywhere on the command line, any filename starting with a '-' has to be preceded by './'. .PP The number of .I retries will not be reset when any following file is being created (i.e. they are simply used up). It can, however, be reset by specifying .RI \-r newretries after every file on the command line. .PP Although files with any name can be used as lockfiles, it is common practice to use the extension `.lock' to lock mailfolders (it is appended to the mailfolder name). In case one does not want to have to worry about too long filenames and does not have to conform to any other lockfilename convention, then an excellent way to generate a lockfilename corresponding to some already existing file is by taking the prefix `lock.' and appending the i-node number of the file which is to be locked. .Sh SOURCE This program is part of the .I procmail mail-processing-package (v3.10 1994/10/31) available at your nearest USENET comp.sources.misc archive, or at ftp.informatik.rwth-aachen.de as .BR pub/packages/procmail/procmail.tar.gz . .Sh MAILINGLIST There exists a mailinglist for questions relating to any program in the procmail package: .RS procmail@informatik.rwth-aachen.de .RS for submitting questions/answers. .RE procmail-request@informatik.rwth-aachen.de .RS for subscription requests. .RE .RE .Sh AUTHOR Stephen R. van den Berg at RWTH-Aachen, Germany .Rs berg@pool.informatik.rwth-aachen.de .\" @MY_ALT_MAIL_ADDR@ .Re .\".if n .pl -(\n(.tu-1i) 07070100002c82000081a400000064000000640000000132f511b700006045000000200000001b00000000000000000000001a00000004reloc/man/man1/procmail.1.\"if n .pl +(135i-\n(.pu) .de Id .ds Rv \\$3 .ds Dt \\$4 .. .Id $Id: procmail.man,v 1.64 1994/10/20 18:14:22 berg Exp $ .TH PROCMAIL 1 \*(Dt BuGless .rn SH Sh .de SH .br .ne 11 .Sh "\\$1" .. .rn SS Ss .de SS .br .ne 10 .Ss "\\$1" .. .rn TP Tp .de TP .br .ne 9 .Tp \\$1 .. .rn RS Rs .de RS .na .nf .Rs .. .rn RE Re .de RE .Re .fi .ad .. .de Sx .PP .ne \\$1 .RS .. .de Ex .RE .PP .. .na .SH NAME procmail \- autonomous mail processor .SH SYNOPSIS .B procmail .RB [ \-ptoY ] .RB [ "\-f \fIfromwhom\fP" ] .RI [ "parameter\fB=\fPvalue " | " rcfile" ] \&.\|.\|. .br .B procmail .RB [ \-toY ] .RB [ "\-f \fIfromwhom\fP" ] .RB [ "\-a \fIargument\fP" ] .B \-d .I recipient \&.\|.\|. .br .B procmail .RB [ \-ptY ] .B \-m .RI [ "parameter\fB=\fPvalue" ] \&.\|.\|. .I rcfile .if n .ti +0.5i .RI [ argument ] \&.\|.\|. .br .B procmail .B \-v .ad .SH DESCRIPTION For a quick start, see .B NOTES at the end. .PP .B Procmail should be invoked automatically over the .B .forward file mechanism as soon as mail arrives. Alternatively, when installed by a system administrator, it can be invoked from within the mailer immediately. When invoked, it first sets some environment variables to default values, reads the mail message from stdin until an EOF, separates the body from the header, and then, if no command line arguments are present, it starts to look for a file named .BR $HOME/.procmailrc . According to the processing recipes in this file, the mail message that just arrived gets distributed into the right folder (and more). If no rcfile is found, or processing of the rcfile falls off the end, procmail will store the mail in the default system mailbox. .PP If no rcfiles and no .B \-p have been specified on the command line, procmail will, prior to reading $HOME/.procmailrc, interpret commands from .B /etc/procmailrc (if present). Care must be taken when creating /etc/procmailrc, because, if circumstances permit, it will be executed with root privileges (contrary to the $HOME/.procmailrc file of course). .PP If running suid root or with root privileges, procmail will be able to perform as a functionally enhanced, backwards compatible mail delivery agent. .PP Procmail can also be used as a general purpose mail filter, i.e. provisions have been made to enable procmail to be invoked in a special sendmail rule. .PP The rcfile format is described in detail in the .BR procmailrc (5) man page. .PP The weighted scoring technique is described in detail in the .BR procmailsc (5) man page. .PP Examples for rcfile recipes can be looked up in the .BR procmailex (5) man page. .SS Signals .TP 1.2i .B TERMINATE Terminate prematurely and requeue the mail. .TP .B HANGUP Terminate prematurely and bounce the mail. .TP .B INTERRUPT Terminate prematurely and bounce the mail. .TP .B QUIT Terminate prematurely and silently lose the mail. .TP .B ALARM Force a timeout (see .BR TIMEOUT). .TP .B USR1 Equivalent to a .BR VERBOSE =off. .TP .B USR2 Equivalent to a .BR VERBOSE =on. .SH OPTIONS .TP 0.5i .B \-v Procmail will print its version number, display its compile time configuration and exit. .TP .B \-p Preserve any old environment. Normally procmail clears the environment upon startup, except for the values of TZ. However, in any case: any default values will override any preexisting environment variables, i.e. procmail will not pay any attention to any predefined environment variables, it will happily overwrite them with its own defaults. For the list of environment variables that procmail will preset see the .BR procmailrc (5) man page. If both \-p and \-m are specified, the list of preset environment variables shrinks to just: LOGNAME, HOME, SHELL, ORGMAIL and MAILDIR. .TP .B \-t Make procmail fail softly, i.e. if procmail cannot deliver the mail to any of the destinations you gave, the mail will not bounce, but will return to the mailqueue. Another delivery-attempt will be made at some time in the future. .TP .I "\fB\-f\fP fromwhom" Causes procmail to regenerate the leading `From ' line with .I fromwhom as the sender (instead of \-f one could use the alternate and obsolete \-r). If .I fromwhom consists merely of a single `-', then procmail will only update the timestamp on the `From ' line (if present, if not, it will generate a new one). .TP .B \-o Instead of allowing anyone to generate `From ' lines, simply override the fakes. .TP .B \-Y Assume traditional Berkeley mailbox format, ignore any .B Content-Length: fields. .TP .I "\fB\-a\fP argument" This will set $1 to be equal to .IR argument . It can be used to pass meta information along to procmail. This is typically done by passing along the $@x information from the sendmail mailer rule. .TP .I "\fB\-d\fP recipient .\|.\|." This turns on explicit delivery mode, delivery will be to the local user .IR recipient . This, of course, only is possible if procmail has root privileges (or if procmail is already running with the recipient's euid and egid). Procmail will setuid to the intended recipients and shall .I only read the recipient's $HOME/.procmailrc file (if present, if not, delivery is like ordinary mail). This option is incompatible with .BR \-p . .TP .B \-m Turns procmail into a general purpose mail filter. In this mode one rcfile must be specified on the command line. After the rcfile, procmail will accept an unlimited number of arguments. If the rcfile is an absolute path starting with .B /etc/procmailrcs/ without backward references (i.e. the parent directory cannot be mentioned) procmail will, only if no security violations are found, take on the identity of the owner of the rcfile (or symbolic link). For some advanced usage of this option you should look in the .B EXAMPLES section below. .SH ARGUMENTS Any arguments containing an '=' are considered to be environment variable assignments, they will .I all be evaluated after the default values have been assigned and before the first rcfile is opened. .PP Any other arguments are presumed to be rcfile paths (either absolute, or if they start with `./' relative to the current directory; .B any other relative path is relative to $HOME, unless the .B \-m option has been given, in which case all relative paths are relative to the current directory); procmail will start with the first one it finds on the command line. The following ones will only be parsed if the preceding ones have a not matching HOST-directive entry, or in case they should not exist. .PP If no rcfiles are specified, it looks for .BR $HOME/.procmailrc . If not even that can be found, processing will continue according to the default settings of the environment variables and the ones specified on the command line. .SH EXAMPLES Examples for rcfile recipes can be looked up in the .BR procmailex (5) man page. A small sample rcfile can be found in the .B NOTES section below. .PP Skip the rest of this EXAMPLES section unless you are a system administrator who is vaguely familiar with sendmail.cf syntax. .PP The .B \-m option is typically used when procmail is called from within a rule in the sendmail.cf file. In order to be able to do this it is convenient to create an extra `procmail' mailer in your sendmail.cf file (in addition to the perhaps already present `local' mailer that starts up procmail). To create such a `procmail' mailer I'd suggest something like: .Sx 2 Mprocmail, P=/opt/SRBprocmail/bin/procmail, F=mSDFMhun, S=11, R=21, A=procmail \-m $h $f $u .Ex This enables you to use rules like the following (most likely in ruleset 0) to filter mail through the procmail mailer (please note the leading tab to continue the rule, and the tab to separate the comments): .Sx 4 R$*<@some.where>$* $#procmail $@/etc/procmailrcs/some.rc $:$1@some.where.procmail$2 R$*<@$*.procmail>$* $1<@$2>$3 Already filtered, map back .Ex And /etc/procmailrcs/some.rc could be as simple as: .Sx 6 :0 # sink all junk mail * ^Subject:.*junk /dev/null :0 # pass along all other mail ! \-oi \-f "$@" .Ex Do watch out when sending mail from within the /etc/procmailrcs/some.rc file, if you send mail to addresses which match the first rule again, you could be creating an endless mail loop. .SH FILES .TP 2.3i .B /etc/passwd to set the recipient's LOGNAME, HOME and SHELL variable defaults .TP .B /usr/mail/$LOGNAME system mailbox; both the system mailbox and the immediate directory it is in will be created everytime procmail starts and either one is not present .TP .B /etc/procmailrc initial global rcfile .TP .B /etc/procmailrcs/ special privileges path for rcfiles .TP .B $HOME/.procmailrc default rcfile .TP .B /usr/mail/$LOGNAME.lock lockfile for the system mailbox (not automatically used by procmail, unless $DEFAULT equals /usr/mail/$LOGNAME and procmail is delivering to $DEFAULT) .TP .B /usr/lib/sendmail default mail forwarder .TP .B _????`hostname` temporary `unique' zero-length files created by procmail .SH "SEE ALSO" .na .nh .BR procmailrc (5), .BR procmailsc (5), .BR procmailex (5), .BR sh (1), .BR csh (1), .BR mail (1), .BR mailx (1), .BR binmail (1), .BR uucp (1), .BR aliases (5), .BR sendmail (8), .BR egrep (1), .BR grep (1), .BR biff (1), .BR comsat (8), .BR lockfile (1), .BR formail (1), .BR cron (1) .hy .ad .SH DIAGNOSTICS .TP 2.3i Autoforwarding mailbox found The system mailbox had its suid or sgid bit set, procmail terminates with EX_NOUSER assuming that this mailbox must not be delivered to. .TP Bad substitution of "x" Not a valid environment variable name specified. .TP Closing brace unexpected There was no corresponding opening brace (nesting block). .TP Conflicting options Not all option combinations are useful .TP Conflicting x suppressed Flag x is not compatible with some other flag on this recipe. .TP Couldn't create "x" The system mailbox was missing and could not/will not be created. .TP Couldn't determine implicit lockfile from "x" There were no `>>' redirectors to be found, using simply `$LOCKEXT' as locallockfile. .TP Couldn't unlock "x" Lockfile was already gone, or write permission to the directory were the lockfile is has been denied. .TP Deadlock attempted on "x" The locallockfile specified on this recipe is equal to a still active $LOCKFILE. .TP Denying special privileges for "x" Procmail will not take on the identity that comes with the rcfile because a security violation was found (e.g. .B \-p or variable assignments on the command line) or procmail had insufficient privileges to do so. .TP Enforcing stricter permissions on "x" The system mailbox of the recipient was found to be unsecured, procmail secured it. .TP Error while writing to "x" Nonexistent subdirectory, no write permission, pipe died or disk full. .TP Exceeded LINEBUF Buffer overflow detected, LINEBUF was too small, memory might be corrupted. .TP Excessive output quenched from "x" The program or filter "x" tried to produce too much output for the current LINEBUF, the rest was discarded. .TP Extraneous x ignored The action line of this recipe makes flag x meaningless. .TP Failed forking "x" Process table is full (and NORESRETRY has been exhausted). .TP Failed to execute "x" Program not in path, or not executable. .TP Forced unlock denied on "x" No write permission in the directory where .B lockfile "x" resides, or more than one procmail trying to force a lock at exactly the same time. .TP Forcing lock on "x" .B Lockfile "x" is going to be removed by force because of a timeout (see also: .BR LOCKTIMEOUT ). .TP Incomplete recipe The start of a recipe was found, but it stranded in an EOF. .TP Insufficient privileges Procmail either needs root privileges, or must have the right (e)uid and (e)gid to run in delivery mode. Delivery will proceed to the invoker. .TP Invalid regexp "x" The regular expression "x" contains errors (most likely some missing or extraneous parens). .TP Kernel-lock failed While trying to use the kernel-supported locking calls, one of them failed (usually indicates an OS error), procmail ignores this error and proceeds. .TP Kernel-unlock failed See above. .TP Lock failure on "x" Can only occur if you specify some real weird (and illegal) lockfilenames or if the .B lockfile could not be created because of insufficient permissions or nonexistent subdirectories. .TP Lost "x" Procmail tried to clone itself but could not find back rcfile "x" (it either got removed or it was a relative path and you changed directory since procmail opened it last time). .TP Missing closing brace A nesting block was started, but never finished. .TP Missing name The \-f option needs an extra argument. .TP Missing argument You specified the \-a option but forgot the argument. .TP Missing rcfile You specified the \-m option, procmail expects the name of an rcfile as argument. .TP Missing recipient You specified the \-d option or called procmail under a different name, it expects one or more recipients as arguments. .TP No space left to finish writing "x" The filesystem containing "x" does not have enough free space to permit delivery of the message to the file. .TP Out of memory The system is out of swap space (and NORESRETRY has been exhausted). .TP Processing continued The unrecognised options on the command line are ignored, proceeding as usual. .TP Program failure (nnn) of "x" Program that was started by procmail returned nnn instead of EXIT_SUCCESS (=0); if nnn is negative, then this is the signal the program died on. .TP Renaming bogus "x" into "x" The system mailbox of the recipient was found to be bogus, procmail performed evasive actions. .TP Skipped: "x" Couldn't do anything with "x" in the rcfile (syntax error), ignoring it. .TP Suspicious rcfile "x" The owner of the rcfile was not the recipient or root, or the directory that contained it was world writable (the rcfile was not used). .TP Terminating prematurely whilst waiting for .\|.\|. Procmail received a signal while it was waiting for .\|.\|. .TP Quota exceeded while writing "x" The filesize quota for the recipient on the filesystem containing "x" does not permit delivering the message to the file. .TP Timeout, terminating "x" Timeout has occurred on program or filter "x". .TP Timeout, was waiting for "x" Timeout has occurred on program, filter or file "x". If it was a program or filter, then it didn't seem to be running anymore. .TP Truncated file to former size The file could not be delivered to successfully, so the file was truncated to its former size. .TP Truncating "x" and retrying lock "x" does not seem to be a valid filename or the file is not empty. .TP Rescue of unfiltered data succeeded/failed A filter returned unsuccessfully, procmail tried to get back the original text. .TP Unexpected EOL Missing closing quote, or trying to escape EOF. .TP Unknown user "x" The specified recipient does not have a corresponding uid. .SH "EXTENDED DIAGNOSTICS" Extended diagnostics can be turned on and off through setting the VERBOSE variable. .TP 2.3i [pid] time & date Procmail's pid and a timestamp. Generated whenever procmail logs a diagnostic and at least a second has elapsed since the last timestamp. .TP Acquiring kernel-lock Procmail now tries to kernel-lock the most recently opened file(descriptor). .TP Assigning "x" Environment variable assignment. .TP Assuming identity of the recipient, VERBOSE=off Dropping all privileges (if any), implicitly turns off extended diagnostics. .TP Bypassed locking "x" The mail spool directory was not accessible to procmail, it relied solely on kernel locks. .TP Executing "x" Starting program "x". If it is started by procmail directly (without an intermediate shell), procmail will show where it separated the arguments by inserting commas. .TP HOST mismatched "x" This host was called "x", HOST contained something else. .TP Locking "x" Creating lockfile "x". .TP Linking to "x" Creating a hardlink between directory folders. .TP Match on "x" Condition matched. .TP Matched "x" Assigned "x" to .BR MATCH . .TP No match on "x" Condition didn't match, recipe skipped. .TP Notified comsat: "$LOGNAME@offset:file" Sent comsat/biff a notice that mail arrived for user $LOGNAME at `offset' in `file'. .TP Opening "x" Opening file "x" for appending. .TP Rcfile: "x" Rcfile changed to "x". .TP Reiterating kernel-lock While attempting several locking methods, one of these failed. Procmail will reiterate until they all succeed in rapid succession. .TP Score: added newtotal "x" This condition scored `added' points, which resulted in a `newtotal' score. .TP Unlocking "x" Removing lockfile "x" again. .SH WARNINGS You should create a shell script that uses .BR lockfile (1) before invoking your mail shell on any mailbox file other than the system mailbox (unless of course, your mail shell uses the same lockfiles (local or global) you specified in your rcfile). .PP In the unlikely event that you absolutely need to kill procmail before it has finished, first try and use the regular kill command (i.e. .I not kill \-9, see the subsection .I Signals for suggestions), otherwise some .I lockfiles might not get removed. .PP Beware when using the .B \-t option, if procmail repeatedly is unable to deliver the mail (e.g. due to an incorrect rcfile), the system mailqueue could fill up. This could aggravate both the local postmaster and other users. .PP The .B /etc/procmailrc file might be executed with root privileges, so be very careful of what you put in it. .B SHELL will be equal to that of the current recipient, so if procmail has to invoke the shell, you'd better set it to some safe value first. See also\h'-\w' 'u' : .BR DROPPRIVS . .PP Keep in mind that if .BR chown (1) is permitted on files in .BR /etc/procmailrcs/ , that they can be chowned to root (or anyone else) by their current owners. For maximum security, make sure this directory is .I executable to root only. .SH BUGS After removing a lockfile by force, procmail waits $SUSPEND seconds before creating a new lockfile so that another process that decides to remove the stale lockfile will not remove the newly created lock by mistake. .PP Procmail uses the regular TERMINATE signal to terminate any runaway filter, but it does not check if the filter responds to that signal and it only sends it to the filter itself, not to any of the filter's children. .PP A continued .B Content-Length: field is not handled correctly. .SH MISCELLANEOUS If there is an existing .B Content-Length: field in the header of the mail and the .B \-Y flag is not specified, procmail will trim the field to report the correct size. Procmail does not change the fieldwidth. .PP If there is no .B Content-Length: field or the .B \-Y has been specified and procmail appends to regular mailfolders, any lines in the body of the message that look like postmarks are prepended with `>' (disarms bogus mailheaders). The regular expression that is used to search for these postmarks is: .RS `\\nFrom ' .RE .PP If the destination name used in explicit delivery mode is not in /etc/passwd, procmail will proceed as if explicit delivery mode was not in effect. If not in explicit delivery mode and should the uid procmail is running under, have no corresponding /etc/passwd entry, then HOME will default to /, LOGNAME will default to #uid and SHELL will default to /bin/sh. .PP When in explicit delivery mode, procmail will generate a leading `From ' line if none is present. If one is already present procmail will leave it intact. If procmail is not invoked with one of the following user or group ids\h'-\w' 'u' : root, daemon, uucp, mail, x400, network, list, lists or news, but still has to generate or accept a new `From ' line, it will generate an additional `>From ' line to help distinguish fake mails. .PP For security reasons procmail will only use an absolute or $HOME-relative rcfile if it is either owned by the recipient or root and not world writable, or if the directory it is contained in is not world writable. .PP If /usr/mail/$LOGNAME is a bogus mailbox (i.e. does not belong to the recipient, is unwritable, is a symbolic link or is a hard link), procmail will upon startup try to rename it into a file starting with `BOGUS.' and ending in an inode-sequence-code. If this turns out to be impossible, .B ORGMAIL will have .I no initial value, and hence will inhibit delivery without a proper rcfile. .PP If /usr/mail/$LOGNAME already is a valid mailbox, but has got too loose permissions on it, procmail will correct this. To prevent procmail from doing this make sure the u+x bit is set. .PP When delivering to directories (or to MH folders) you .B don't need to use lockfiles to prevent several concurrently running procmail programs from messing up. .PP Delivering to MH folders is slightly more time consuming than delivering to normal directories or mailboxes, because procmail has to search for the next available number (instead of having the filename immediately available). .PP On general failure procmail will return EX_CANTCREAT, unless option .B \-t is specified, in which case it will return EX_TEMPFAIL. .PP To make `egrepping' of headers more consistent, procmail concatenates all continued header fields; but only internally. When delivering the mail, line breaks will appear as before. .PP If procmail is called under a name not starting with `procmail' (e.g. if it is linked to another name and invoked as such), it comes up in explicit delivery mode, and expects the recipients' names as command line arguments (as if \-d had been specified). .PP Comsat/biff notifications are done using udp. They are sent off once when procmail generates the regular logfile entry. The notification messages have the following extended format (or as close as you can get when final delivery was not to a file): .RS $LOGNAME@offset_of_message_in_mailbox\h'-\w' 'u' :absolute_path_to_mailbox .RE .PP Whenever procmail itself opens a file to deliver to, it consistently uses the following kernel locking strategies\h'-\w' 'u' : .BR fcntl (2) and .BR lockf (3). .PP Procmail is NFS-resistant and eight-bit clean. .br .ne 11 .SH NOTES Calling up procmail with the \-h or \-? options will cause it to display a command-line help and recipe flag quick-reference page. .PP If procmail is .I not installed globally as the default mail delivery agent (ask your system administrator), you have to make sure it is invoked when your mail arrives. In this case your $HOME/.forward (beware, it .B has to be world readable) file should contain the line below. Be sure to include the single and double quotes, and it .I must be an .I absolute path. The \fB#\fP\fIYOUR_USERNAME\fP is not actually a parameter that is required by procmail, in fact, it will be discarded by sh before procmail ever sees it; it is however a necessary kludge against overoptimising sendmail programs: .PP .na .nf "\h'-\w' 'u' |IFS=' '&&exec /usr/local/bin/procmail -f-\h'-\w' 'u' |\h'-\w' 'u' |exit 75 \fB#\fP\fIYOUR_USERNAME\fP" .fi .ad .PP Procmail can also be invoked to postprocess an already filled system mailbox. This can be useful if you don't want to or can't use a $HOME/.forward file (in which case the following script could periodically be called from within .BR cron (1), or whenever you start reading mail): .Sx 17 #!/bin/sh ORGMAIL=/usr/mail/$LOGNAME if cd $HOME && test \-s $ORGMAIL && lockfile \-r0 \-l3600 .newmail.lock 2>/dev/null then trap "rm \-f .newmail.lock" 1 2 3 15 umask 077 lockfile \-l3600 \-ml cat $ORGMAIL >>.newmail && cat /dev/null >$ORGMAIL lockfile \-mu formail \-s procmail <.newmail && rm \-f .newmail rm \-f .newmail.lock fi exit 0 .Ex .ne 14 .SS "A sample small $HOME/.procmailrc:" .na .nf PATH=/bin:/usr/bin:/opt/SRBprocmail/bin MAILDIR=$HOME/Mail #you'd better make sure it exists DEFAULT=$MAILDIR/mbox #completely optional LOGFILE=$MAILDIR/from #recommended :0: * ^From.*berg from_me :0 * ^Subject:.*Flame /dev/null .fi .ad .PP Other examples for rcfile recipes can be looked up in the .BR procmailex (5) man page. .Sh SOURCE This program is part of the .I procmail mail-processing-package (v3.10 1994/10/31) available at your nearest USENET comp.sources.misc archive, or at ftp.informatik.rwth-aachen.de as .BR pub/packages/procmail/procmail.tar.gz . .Sh MAILINGLIST There exists a mailinglist for questions relating to any program in the procmail package: .RS procmail@informatik.rwth-aachen.de .RS for submitting questions/answers. .RE procmail-request@informatik.rwth-aachen.de .RS for subscription requests. .RE .RE .Sh AUTHOR Stephen R. van den Berg at RWTH-Aachen, Germany .Rs berg@pool.informatik.rwth-aachen.de .\" @MY_ALT_MAIL_ADDR@ .Re .\".if n .pl -(\n(.tu-1i) 0707010000fb04000041ed00000064000000640000000232f512fc00000000000000200000001b00000000000000000000000f00000004reloc/man/man50707010000fb05000081a400000064000000640000000132f511b700003a4c000000200000001b00000000000000000000001c00000004reloc/man/man5/procmailex.5.\"if n .pl +(135i-\n(.pu) .de Id .ds Rv \\$3 .ds Dt \\$4 .. .Id $Id: procmailex.man,v 1.44 1994/10/31 20:11:52 berg Exp $ .TH PROCMAILEX 5 \*(Dt BuGless .rn SH Sh .de SH .br .ne 11 .Sh "\\$1" .. .rn SS Ss .de SS .br .ne 10 .Ss "\\$1" .. .rn TP Tp .de TP .br .ne 9 .Tp \\$1 .. .rn RS Rs .de RS .na .nf .Rs .. .rn RE Re .de RE .Re .fi .ad .. .de Sx .PP .ne \\$1 .RS .. .de Ex .RE .PP .. .na .SH NAME procmailex \- procmail rcfile examples .SH SYNOPSIS .B $HOME/.procmailrc examples .ad .SH DESCRIPTION For a description of the rcfile format see .BR procmailrc (5). .PP The weighted scoring technique is described in detail in the .BR procmailsc (5) man page. .PP This man page shows several example recipes. For examples of complete rcfiles you can check the NOTES section in .BR procmail (1), or look at the example rcfiles part of the procmail source distribution (procmail*/examples/?procmailrc). .SH EXAMPLES Sort out all mail coming from the scuba-dive mailing list into the mailfolder scubafile (uses the locallockfile scubafile.lock). .Sx 3 :0: * ^TOscuba scubafile .Ex Forward all mail from peter about compilers to william (and keep a copy of it here in petcompil). .Sx 10 :0 * ^From.*peter * ^Subject:.*compilers { :0 c ! william@somewhere.edu :0 petcompil } .Ex An equivalent solution that accomplishes the same: .Sx 7 :0 c * ^From.*peter * ^Subject:.*compilers ! william@somewhere.edu :0 A petcompil .Ex An equivalent, but slightly slower solution that accomplishes the same: .Sx 9 :0 c * ^From.*peter * ^Subject:.*compilers ! william@somewhere.edu :0 * ^From.*peter * ^Subject:.*compilers petcompil .Ex If you are fairly new to procmail and plan to experiment a little bit it often helps to have a .I safety net of some sort. Inserting the following two recipes above all other recipes will make sure that of all arriving mail always the last 32 messages will be preserved. In order for it to work as intended, you have to create a directory named `backup' in $MAILDIR prior to inserting these two recipes. .Sx 5 :0 c backup :0 ic | cd backup && rm \-f dummy `ls \-t msg.* | sed \-e 1,32d` .Ex If your system doesn't generate or generates incorrect leading `From ' lines on every mail, you can fix this by calling up procmail with the \-f- option. To fix the same problem by different means, you could have inserted the following two recipes above all other recipes in your rcfile. They will filter the header of any mail through formail which will strip any leading `From ', and automatically regenerates it subsequently. .Sx 2 :0 fhw | formail \-I "From " \-a "From " .Ex Add the headers of all messages that didn't come from the postmaster to your private header collection (for statistics or mail debugging); and use the lockfile `headc.lock'. In order to make sure the lockfile is not removed until the pipe has finished, you have to specify option `w'; otherwise the lockfile would be removed as soon as the pipe has accepted the mail. .Sx 3 :0 hwc: * !^FROM_MAILER | uncompress headc.Z; cat >>headc; compress headc .Ex Or, if you would use the more efficient gzip instead of compress: .Sx 3 :0 hwc: * !^FROM_MAILER | gzip >>headc.gz .Ex Forward all mails shorter than 1000 bytes to my home address (no lockfile needed on this recipe). .Sx 3 :0 * < 1000 ! myname@home .Ex Split up incoming digests from the surfing mailing list into their individual messages, and store them into surfing, using surfing.lock as the locallockfile. .Sx 3 :0: * ^Subject:.*surfing.*Digest | formail +1 \-ds >>surfing .Ex Store everything coming from the postmaster or mailer-daemon (like bounced mail) into the file postm, using postm.lock as the locallockfile. .Sx 3 :0: * ^FROM_MAILER postm .Ex A simple autoreply recipe. It makes sure that neither mail from any daemon (like bouncing mail or mail from mailing-lists), nor autoreplies coming from yourself will be autoreplied to. If this precaution would not be taken, disaster could result (`ringing' mail). In order for this recipe to autoreply to all the incoming mail, you should of course insert it before all other recipes in your rcfile. However, it is advisable to put it .I after any recipes that process the mails from subscribed mailinglists; it generally is not a good idea to generate autoreplies to mailinglists (yes, the !^FROM_DAEMON regexp should already catch those, but if the mailinglist doesn't follow accepted conventions, this might not be enough). .Sx 6 :0 h c * !^FROM_DAEMON * !^X-Loop: your@own.mail.address | (formail \-r \-A"Precedence: junk" \e \-A"X-Loop: your@own.mail.address" ; \e echo "Mail received.") | $SENDMAIL \-t .Ex A more complicated autoreply recipe that implements the functional equivalent of the well known .BR vacation (1) program. This recipe is based on the same principles as the last one (prevent `ringing' mail). In addition to that however, it maintains a vacation database by extracting the name of the sender and inserting it in the vacation.cache file if the name was new (the vacation.cache file is maintained by formail which will make sure that it always contains the most recent names, the size of the file is limited to a maximum of aproximately 8192 bytes). If the name was new, an autoreply will be sent. .Sx 14 SHELL=/bin/sh # for other shells, this might need adjustment :0 Whc: vacation.lock * !^FROM_DAEMON * !^X-Loop: your@own.mail.address | formail \-rD 8192 vacation.cache :0 ehc # if the name was not in the cache | (formail \-rA"Precedence: junk" \e \-A"X-Loop: your@own.mail.address" ; \e echo "I received your mail,"; \e echo "but I won't be back until Monday."; \e echo "-- "; cat $HOME/.signature \e ) | $SENDMAIL \-oi \-t .Ex Store all messages concerning TeX in separate, unique filenames, in a directory named texmail (this directory has to exist); there is no need to use lockfiles in this case, so we won't. .Sx 3 :0 * (^TO|^Subject:.*)TeX[^t] texmail .Ex The same as above, except now we store the mails in numbered files (MH mail folder). .Sx 3 :0 * (^TO|^Subject:.*)TeX[^t] texmail/. .Ex Or you could file the mail in several directory folders at the same time. The following recipe will deliver the mail to two MH-folders and one directory folder. It is actually only one file with two extra hardlinks. .Sx 3 :0 * (^TO|^Subject:.*)TeX[^t] texmail/. wordprocessing dtp/. .Ex Store all the messages about meetings in a folder that is in a directory that changes every month. E.g. if it were January 1994, the folder would have the name `94-01/meeting' and the locallockfile would be `94-01/meeting.lock'. .Sx 3 :0: * meeting `date +%y-%m`/meeting .Ex The same as above, but, if the `94-01' directory wouldn't have existed, it is created automatically: .Sx 9 MONTHFOLDER=`date +%y-%m` :0 ic * ? test ! \-d $MONTHFOLDER | mkdir $MONTHFOLDER :0: * meeting ${MONTHFOLDER}/meeting .Ex The same as above, but now by slightly different means: .Sx 6 MONTHFOLDER=`date +%y-%m` DUMMY=`test \-d $MONTHFOLDER || mkdir $MONTHFOLDER` :0: * meeting ${MONTHFOLDER}/meeting .Ex If you are subscribed to several mailinglists and people cross-post to some of them, you usually receive several duplicate mails (one from every list). The following simple recipe eliminates duplicate mails. It tells formail to keep an 8KB cache file in which it will store the Message-IDs of the most recent mails you received. Since Message-IDs are guaranteed to be unique for every new mail, they are ideally suited to weed out duplicate mails. Simply put the following recipe at the top of your rcfile, and no duplicate mail will get past it. .Sx 2 :0 Wh: msgid.lock | formail \-D 8192 msgid.cache .Ex When delivering to emacs folders (i.e. mailfolders managed by any emacs mail package, e.g. RMAIL or VM) directly, you should use emacs-compatible lockfiles. The emacs mailers are a bit braindamaged in that respect, they get very upset if someone delivers to mailfolders which they already have in their internal buffers. The following recipe assumes that $HOME equals /home/john. .Sx 5 MAILDIR=Mail :0:/usr/local/lib/emacs/lock/!home!john!Mail!mailbox * ^Subject:.*whatever mailbox .Ex Alternatively, you can have procmail deliver into its own set of mailboxes, which you then periodically empty and copy over to your emacs files using .BR movemail . Movemail uses mailbox.lock local lockfiles per mailbox. .PP To extract certain headers from a mail and put them into environment variables you can use any of the following constructs: .Sx 5 SUBJECT=`formail \-xSubject:` # regular field FROM=`formail \-rt \-xTo:` # special case :0 h # alternate method KEYWORDS=| formail \-xKeywords: .Ex If you are using temporary files in a procmailrc file, and want to make sure that they are removed just before procmail exits, you could use something along the lines of: .Sx 2 TEMPORARY=$HOME/tmp/pmail.$$ TRAP="/bin/rm \-f $TEMPORARY" .Ex The TRAP keyword can also be used to change the exitcode of procmail. I.e. if you want procmail to return an exitcode of `1' instead of its regular exitcodes, you could use: .Sx 3 EXITCODE="" TRAP="exit 1;" # The trailing semi-colon is important # since exit is not a standalone program .Ex Or, if the exitcode does not need to depend on the programs run from the TRAP, you can use a mere: .Sx 1 EXITCODE=1 .Ex The following recipe prints every incoming mail that looks like a postscript file. .Sx 3 :0 Bb * ^^%! | lpr .Ex The following recipe does the same, but is a bit more selective. It only prints the postscript file if it comes from the print-server. The first condition matches only if it is found in the header. The second condition only matches at the start of the body. .Sx 4 :0 b * ^From[ :].*print-server * B ?? ^^%! | lpr .Ex The same as above, but now by slightly different means: .Sx 7 :0 * ^From[ :].*print-server { :0 B b * ^^%! | lpr } .Ex Likewise: .Sx 4 :0 HB b * ^^(.+$)*From[ :].*print-server * ^^(.+$)*^%! | lpr .Ex Suppose you have two accounts, you use both accounts regularly, but they are in very distinct places (i.e. you can only read mail that arrived at either one of the accounts). You would like to forward mail arriving at account one to account two, and the other way around. The first thing that comes to mind is using .forward files at both sites; this won't work of course, since you will be creating a mail loop. This mail loop can be avoided by inserting the following recipe in front of all other recipes in the $HOME/.procmailrc files on both sites. If you make sure that you add the same X-Loop: field at both sites, mail can now safely be forwarded to the other account from either of them. .Sx 4 :0 c * !^X-Loop: yourname@your.main.mail.address | formail \-A "X-Loop: yourname@your.main.mail.address" | \e $SENDMAIL \-oi yourname@the.other.account .Ex If someone sends you a mail with the word `retrieve' in the subject, the following will automatically send back the contents of info_file to the sender. Like in all recipes where we send mail, we watch out for mail loops. .Sx 6 :0 * !^From +YOUR_USERNAME * !^Subject:.*Re: * !^FROM_DAEMON * ^Subject:.*retrieve | (formail \-r ; cat info_file) | $SENDMAIL \-oi \-t .Ex Now follows an example for a very simple fileserver accessible by mail. For more demanding applications, I suggest you take a look at .B SmartList (available from the same place as the procmail distribution). As listed, this fileserver sends back at most one file per request, it ignores the body of incoming mails, the Subject: line has to look like "Subject: send file the_file_you_want" (the blanks are significant), it does not return files that have names starting with a dot, nor does it allow files to be retrieved that are outside the fileserver directory tree (if you decide to munge this example, make sure you do not inadvertently loosen this last restriction). .Sx 18 :0 * ^Subject: send file [0-9a-z] * !^X-Loop: yourname@your.main.mail.address * !^Subject:.*Re: * !^FROM_DAEMON * !^Subject: send file .*[/.]\e. { MAILDIR=$HOME/fileserver # chdir to the fileserver directory :0 fhw # reverse mailheader and extract name * ^Subject: send file \e/[^ ]* | formail \-rA "X-Loop: yourname@your.main.mail.address" FILE="$MATCH" # the requested filename :0 ah | cat \- ./$FILE 2>&1 | $SENDMAIL \-oi \-t } .Ex The following example preconverts all plain-text mail arriving in certain encoded MIME formats into a more compact 8-bit format which can be used and displayed more easily by most programs. The .BR mimencode (1) program is part of Nathaniel Borenstein's metamail package. .Sx 17 :0 * ^Content-Type: *text/plain { :0 fbw * ^Content-Transfer-Encoding: *quoted-printable | mimencode \-u \-q :0 Afhw | formail \-I "Content-Transfer-Encoding: 8bit" :0 fbw * ^Content-Transfer-Encoding: *base64 | mimencode \-u \-b :0 Afhw | formail \-I "Content-Transfer-Encoding: 8bit" } .Ex The following one is rather exotic, but it only serves to demonstrate a feature. Suppose you have a file in your HOME directory called ".urgent", and the (one) person named in that file is the sender of an incoming mail, you'd like that mail to be stored in $MAILDIR/urgent instead of in any of the normal mailfolders it would have been sorted in. Then this is what you could do (beware, the filelength of $HOME/.urgent should be well below $LINEBUF, increase LINEBUF if necessary): .Sx 5 URGMATCH=`cat $HOME/.urgent` :0 B: * $^From.*${URGMATCH} urgent .Ex An entirely different application for procmail would be to conditionally apply filters to a certain (outgoing) text or mail. A typical example would be a filter through which you pipe all outgoing mail, in order to make sure that it will be MIME encoded only if it needs to be. I.e. in this case you could start procmail in the middle of a pipe like: .Sx 1 cat newtext | procmail ./mimeconvert | mail chris@where.ever .Ex The .B mimeconvert rcfile could contain something like (the =0x80= and =0xff= should be substituted with the real 8-bit characters): .Sx 10 DEFAULT=| # pipe to stdout instead of # delivering mail as usual :0 Bfbw * [=0x80=-=0xff=] | mimencode \-q :0 Afhw | formail \-I 'MIME-Version: 1.0' \e \-I 'Content-Type: text/plain; charset=ISO-8859-1' \e \-I 'Content-Transfer-Encoding: quoted-printable' .Ex .SH "SEE ALSO" .na .nh .BR procmail (1), .BR procmailrc (5), .BR procmailsc (5), .BR sh (1), .BR csh (1), .BR mail (1), .BR mailx (1), .BR binmail (1), .BR uucp (1), .BR aliases (5), .BR sendmail (8), .BR egrep (1), .BR grep (1), .BR biff (1), .BR comsat (8), .BR mimencode (1), .BR lockfile (1), .BR formail (1) .hy .ad .Sh AUTHOR Stephen R. van den Berg at RWTH-Aachen, Germany .Rs berg@pool.informatik.rwth-aachen.de .\" @MY_ALT_MAIL_ADDR@ .Re .\".if n .pl -(\n(.tu-1i) 0707010000fb06000081a400000064000000640000000132f511b7000062ba000000200000001b00000000000000000000001c00000004reloc/man/man5/procmailrc.5.\"if n .pl +(135i-\n(.pu) .de Id .ds Rv \\$3 .ds Dt \\$4 .. .Id $Id: procmailrc.man,v 1.56 1994/10/31 18:02:12 berg Exp $ .TH PROCMAILRC 5 \*(Dt BuGless .rn SH Sh .de SH .br .ne 11 .Sh "\\$1" .. .rn SS Ss .de SS .br .ne 10 .Ss "\\$1" .. .rn TP Tp .de TP .br .ne 9 .Tp \\$1 .. .rn RS Rs .de RS .na .nf .Rs .. .rn RE Re .de RE .Re .fi .ad .. .de Sx .PP .ne \\$1 .RS .. .de Ex .RE .PP .. .na .SH NAME procmailrc \- procmail rcfile .SH SYNOPSIS .B $HOME/.procmailrc .ad .SH DESCRIPTION For a quick start, see .B NOTES at the end of the .BR procmail (1) man page. .PP The rcfile can contain a mixture of environment variable assignments (some of which have special meanings to procmail), and recipes. In their most simple appearance, the recipes are simply one line regular expressions that are searched for in the header of the arriving mail, the first recipe that matches is used to determine where the mail has to go (usually a file). If processing falls off the end of the rcfile, procmail will deliver the mail to .BR $DEFAULT . .PP There are two kinds of recipes: delivering and non-delivering recipes. If a .I delivering recipe is found to match, procmail considers the mail (you guessed it) delivered and will .I cease processing the rcfile after having successfully executed the action line of the recipe. If a .I non-delivering recipe is found to match, processing of the rcfile will .I continue after the action line of this recipe has been executed. .PP Delivering recipes are those that cause header and/or body of the mail to be written into a file, absorbed by a program or forwarded to a mailaddress. .PP Non-delivering recipes are those that cause the output of a program or filter to be captured back by procmail or those that start a nesting block. .PP You can tell procmail to treat a .I delivering recipe as if it were a non-delivering recipe by specifying the `c' flag on such a recipe. This will make procmail generate a .I carbon copy of the mail by delivering it to this recipe, yet continue processing the rcfile. .PP By using any number of recipes you can presort your mail extremely straightforward into several mailfolders. Bear in mind though that the mail can arrive concurrently in these mailfolders (if several procmail programs happen to run at the same time, not unlikely if a lot of mail arrives), to make sure this does not result in a mess, proper use of lockfiles is highly recommended. .PP The environment variable .B assignments and .B recipes can be freely intermixed in the rcfile. If any environment variable has a special meaning to procmail, it will be used appropriately the moment it is parsed. (i.e. you can change the current directory whenever you want by specifying a new .BR MAILDIR , switch lockfiles by specifying a new .BR LOCKFILE , change the umask at any time, etc., the possibilities are endless :\-). .PP The assignments and substitutions of these environment variables are handled exactly like in .BR sh (1) (that includes all possible quotes and escapes), with the added bonus that blanks around the '=' sign are ignored and that, if an environment variable appears without a trailing '=', it will be removed from the environment. Any program in backquotes started by procmail will have the entire mail at its stdin. .PP .SS Comments A word beginning with # and all the following characters up to a NEWLINE are ignored. This does not apply to condition lines, which cannot be commented. .SS Recipes .PP A line starting with ':' marks the beginning of a recipe. It has the following format: .Sx 3 :0 [\fIflags\fP] [ : [\fIlocallockfile\fP] ] .Ex Conditions start with a leading `*', everything after that character is passed on to the internal egrep .BR literally , except for leading and trailing whitespace. These regular expressions are .B completely compatible to the normal .BR egrep (1) extended regular expressions. See also .BR "Extended regular expressions" . .PP Conditions are anded; if there are no conditions the result will be true be default. .PP .I Flags can be any of the following: .TP 0.5i .B H Egrep the header (default). .TP .B B Egrep the body. .TP .B D Tell the internal egrep to distinguish between upper and lower case (contrary to the default which is to ignore case). .TP .B A This recipe will depend on the last preceding recipe (on the current block-nesting level) without the `A' or `a' flag. This allows you to chain actions that depend on a common condition. .TP .B a Has the same meaning as the `A' flag, but will depend on the .I successful completion of the immediately preceding recipe as well. .TP .B E This recipe only executes if the immediately preceding recipe was not executed. Execution of this recipe also disables any immediately following recipes with the 'E' flag. This allows you to specify `else if' actions. .TP .B e This recipe only executes if the immediately preceding recipe .IR failed . This allows you to specify `error' actions. .TP .B h Feed the header to the pipe (default). .TP .B b Feed the body to the pipe (default). .TP .B f Consider the pipe as a filter. .TP .B c Generate a .B carbon copy of this mail. This only makes sense on .I delivering recipes. The only non-delivering recipe this flag has an effect on is on a nesting block, in order to generate a carbon copy this will .B clone the running procmail process (lockfiles will not be inherited), whereas the clone will proceed as usual and the parent will jump across the block. .TP .B w Wait for the filter or program to finish and check its exitcode (normally ignored); if the filter is unsuccessful, then the text will not have been filtered. .TP .B W Has the same meaning as the `w' flag, but will suppress any `Program failure' message. .TP .B i Ignore any write errors on this recipe (i.e. usually due to an early closed pipe). .TP .B r Raw mode, do not try to ensure the mail ends with an empty line, write it out as is. .PP There are some special conditions you can use that are not straight regular expressions. To select them, the condition must start with: .TP 0.5i .B ! Invert the condition. .TP .B $ Evaluate the remainder according to .BR sh (1) substitution rules inside double quotes, skip leading whitespace, then reparse it. .TP .B ? Use the exitcode of the specified program. .TP .B < Check if the total length of the mail is shorter than the specified (in decimal) number of bytes. .TP .B > Analogous to '<'. .TP .B "variablename \fI??\fP" Match the remainder against the value of this environment variable (this cannot be a pseudo variable). Special cases are `B', `H', `HB' and `BH', which merely override the default header/body search area defined for this recipe. .TP .B \e To quote any of the above at the start of the line. .SS "Local lockfile" .PP If you put a second (trailing) ':' on the first recipe line, then procmail will use a .I locallockfile (for this recipe only). You can optionally specify the locallockfile to use; if you don't however, procmail will use the destination filename (or the filename following the first '>>') and will append $LOCKEXT to it. .SS "Recipe action line" .PP The action line can start with the following characters: .TP .B ! Forwards to all the specified mail addresses. .TP .B | Starts the specified program, possibly in $SHELL if any of the characters $SHELLMETAS are spotted. You can optionally prepend this pipe symbol with .IR variable= , which will cause stdout of the program to be captured in the environment .IR variable . If you specify just this pipe symbol, without any program, then procmail will pipe the mail to stdout. .TP .B { Followed by at least one space, tab or newline will mark the start of a nesting block. Everything up till the next closing brace will depend on the conditions specified for this recipe. Unlimited nesting is permitted. The closing brace exists merely to delimit the block, it will .I not cause procmail to terminate in any way. If the end of a block is reached processing will continue as usual after the block. On a nesting block, the flags `H' and `B' only affect the conditions leading up to the block, the flags `h' and `b' have no effect whatsoever. .PP Anything else will be taken as a mailbox name (either a filename or a directory, absolute or relative to the current directory (see MAILDIR)). If it is a (possibly yet inexistent) filename, the mail will be appended to it. .PP If it is a directory, the mail will be delivered to a newly created, guaranteed to be unique file named $MSGPREFIX* in the specified directory. If the directory name ends in "/.", then this directory is presumed to be an MH folder; i.e. procmail will use the next number it finds available. When procmail is delivering to directories, you can specify multiple directories to deliver to (using hardlinks). .SS "Environment variable defaults" .TP 2.2i .B "LOGNAME, HOME and SHELL" Your (the recipient's) defaults .TP .B SHELLMETAS \&&\h'-\w' 'u' |<>~;?*[ .TP .B SHELLFLAGS \&-c .TP .BR ORGMAIL \&/usr/mail/$LOGNAME .br (Unless \-m has been specified, in which case it is unset) .TP .B MAILDIR \&$HOME/ .br (Unless the name of the first successfully opened rcfile starts with `./', in which case it defaults to `.') .TP .B DEFAULT \&$ORGMAIL .TP .B MSGPREFIX \&msg. .TP .B SENDMAIL \&/usr/lib/sendmail .TP .B HOST The current hostname .TP .B COMSAT \&no .br (If an rcfile is specified on the command line) .TP .B LOCKEXT \&.lock .na .PP Other cleared or preset environment variables are IFS, ENV, PWD, PATH=$HOME/bin\h'-\w' 'u' :/bin\h'-\w' 'u' :/usr/ucb\h'-\w' 'u' :/usr/local/bin\h'-\w' 'u' :/usr/bin/X11 and USER=$LOGNAME. .ad .SS Environment .PP Before you get lost in the multitude of environment variables, keep in mind that all of them have reasonable defaults. .TP 1.2i .B MAILDIR Current directory while procmail is executing (that means that all paths are relative to $MAILDIR). .TP .B DEFAULT Default .B mailbox file (if not told otherwise, procmail will dump mail in this mailbox). Procmail will automatically use $DEFAULT$LOCKEXT as lockfile prior to writing to this mailbox. You do not need to set this variable, since it already points to the standard system mailbox. .TP .B LOGFILE This file will also contain any error or diagnostic messages from procmail (normally none :\-) or any other programs started by procmail. If this file is not specified, any diagnostics or error messages will be mailed back to the sender. See also .BR LOGABSTRACT . .TP .B VERBOSE You can turn on .I extended diagnostics by setting this variable to `yes' or `on', to turn it off again set it to `no' or `off'. .TP .B LOGABSTRACT Just before procmail exits it logs an abstract of the delivered message in $LOGFILE showing the `From ' and `Subject:' fields of the header, what folder it finally went to and how long (in bytes) the message was. By setting this variable to `no', generation of this abstract is suppressed. If you set it to `all', procmail will log an abstract for every successful .I delivering recipe it processes. .TP .B LOG Anything assigned to this variable will be appended to $LOGFILE. .TP .B ORGMAIL Usually the system mailbox (\fBOR\fPi\fBG\fPinal \fBMAIL\fPbox). If, for some obscure reason (like `\fBfilesystem full\fP') the mail could not be delivered, then this mailbox will be the last resort. If procmail fails to save the mail in here (deep, deep trouble :\-), then the mail will bounce back to the sender. .TP .B LOCKFILE Global semaphore file. If this file already exists, procmail will wait until it has gone before proceeding, and will create it itself (cleaning it up when ready, of course). If more than one .I lockfile are specified, then the previous one will be removed before trying to create the new one. The use of a global lockfile is discouraged, whenever possible use locallockfiles (on a per recipe basis) instead. .TP .B LOCKEXT Default extension that is appended to a destination file to determine what local .I lockfile to use (only if turned on, on a per-recipe basis). .TP .B LOCKSLEEP Number of seconds procmail will sleep before retrying on a .I lockfile (if it already existed); if not specified, it defaults to 8 seconds. .TP .B LOCKTIMEOUT Number of seconds that have to have passed since a .I lockfile was last modified/created before procmail decides that this must be an erroneously leftover lockfile that can be removed by force now. If zero, then no timeout will be used and procmail will wait forever until the lockfile is removed; if not specified, it defaults to 1024 seconds. This variable is useful to prevent indefinite hangups of .BR sendmail /procmail. Procmail is immune to clock skew across machines. .TP .B TIMEOUT Number of seconds that have to have passed before procmail decides that some child it started must be hanging. The offending program will receive a TERMINATE signal from procmail, and processing of the rcfile will continue. If zero, then no timeout will be used and procmail will wait forever until the child has terminated; if not specified, it defaults to 960 seconds. .TP .B MSGPREFIX Filename prefix that is used when delivering to a directory (not used when delivering to an MH directory). .TP .B HOST If this is not the .I hostname of the machine, processing of the current .I rcfile will immediately cease. If other rcfiles were specified on the command line, processing will continue with the next one. If all rcfiles are exhausted, the program will terminate, but will not generate an error (i.e. to the mailer it will seem that the mail has been delivered). .TP .B UMASK The name says it all (if it doesn't, then forget about this one :\-). Anything assigned to UMASK is taken as an .B octal number. If not specified, the umask defaults to 077. If the umask permits o+x, all the mailboxes procmail delivers to directly will receive an o+x mode change. This can be used to check if new mail arrived. .TP .B SHELLMETAS If any of the characters in SHELLMETAS appears in the line specifying a filter or program, the line will be fed to $SHELL instead of being executed directly. .TP .B SHELLFLAGS Any invocation of $SHELL will be like: .br "$SHELL" "$SHELLFLAGS" "$*"; .TP .B SENDMAIL If you're not using the .I forwarding facility don't worry about this one. It specifies the program being called to forward any mail. .br It gets invoked as: "$SENDMAIL" "$@"; .TP .B NORESRETRY Number of retries that are to be made if any `\fBprocess table full\fP', `\fBfile table full\fP', `\fBout of memory\fP' or `\fBout of swap space\fP' error should occur. If this number is negative, then procmail will retry indefinitely; if not specified, it defaults to 4 times. The retries occur with a $SUSPEND second interval. The idea behind this is, that if e.g. the .I swap .I space has been exhausted or the .I process .I table is full, usually several other programs will either detect this as well and abort or crash 8-), thereby freeing valuable .I resources for procmail. .TP .B SUSPEND Number of seconds that procmail will pause if it has to wait for something that is currently unavailable (memory, fork, etc.); if not specified, it will default to 16 seconds. See also: .BR LOCKSLEEP . .TP .B LINEBUF Length of the internal line buffers, cannot be set smaller than 128. All lines read from the .I rcfile should not exceed $LINEBUF characters before and after expansion. If not specified, it defaults to 2048. This limit, of course, does .I not apply to the mail itself, which can have arbitrary line lengths, or could be a binary file for that matter. .TP .B DELIVERED If set to `yes' procmail will pretend (to the mail agent) the mail has been delivered. If mail cannot be delivered after having met this assignment (set to `yes'), the mail will be lost (i.e. it will not bounce). .TP .B TRAP When procmail terminates it will execute the contents of this variable. A copy of the mail can be read from stdin. Any output produced by this command will be appended to $LOGFILE. Possible uses for TRAP are: removal of temporary files, logging customised abstracts, etc. See also .B EXITCODE and .BR LOGABSTRACT . .TP .B EXITCODE When procmail terminates and this variable has been set to a positive numeric value, procmail will use this as the exitcode. If this variable is set but empty, procmail will set the exitcode to whatever the .B TRAP program returns. If this variable has not been set, procmail will set it shortly before calling up the .B TRAP program. .TP .B LASTFOLDER This variable is assigned to by procmail whenever it is delivering to a folder or program. It always contains the name of the last folder (or program) procmail delivered to. .TP .B MATCH This variable is assigned to by procmail whenever it is told to extract text from a matching regular expression. It will contain all text matching the regular expression past the `\fB\e/\fP' token. .TP .B SHIFT Assigning a positive value to this variable has the same effect as the `shift' command in .BR sh (1). This command is most useful to extract extra arguments passed to procmail when acting as a generic mailfilter. .TP .B INCLUDERC Names an rcfile (relative to the current directory) which will be included here as if it were part of the current rcfile. Unlimited nesting is permitted. .TP .B COMSAT .BR Comsat (8)/ biff (1) notification is on by default, it can be turned off by setting this variable to `no'. Alternatively the biff-service can be customised by setting it to either `service@', `@hostname', or `service@hostname'. When not specified it defaults to biff@localhost. .TP .B DROPPRIVS If set to `yes' procmail will drop all privileges it might have had (suid or sgid). This is only useful if you want to guarantee that the bottom half of the /etc/procmailrc file is executed on behalf of the recipient. .SS "Extended regular expressions" The following tokens are known to both the procmail internal egrep and the standard .BR egrep (1): .TP 1.0i .B ^ Start of a line. .TP .B $ End of a line. .TP .B . Any character except a newline. .TP .B a* Any sequence of zero or more a's. .TP .B a+ Any sequence of one or more a's. .TP .B a? Either zero or one a. .TP .B [^-a-d] Any character which is .B not either a dash, a, b, c, d or newline. .TP .B de|abc Either the sequence `de' or `abc'. .TP .B (abc)* Zero or more times the sequence `abc'. .PP These were only samples, of course, any more complex combination is valid as well. .PP The following token meanings are special procmail extensions: .TP 1.0i \fB^\fP or \fB$\fP Match a newline (for multiline matches). .TP .B ^^ Anchor the expression at the very start of the search area, or if encountered at the end of the expression, anchor it at the very end of the search area. .TP \fB\e<\fP or \fB\e>\fP Match the character before or after a word. They are merely a shorthand for `[^a-zA-Z0-9_]', but can also match newlines. Since they match actual characters, they are only suitable to delimit words, not to delimit inter-word space. .TP .B \e/ Splits the expression in two parts. Everything matching the right part will be assigned to the MATCH environment variable. .SH EXAMPLES Look in the .BR procmailex (5) man page. .SH CAVEATS Continued lines in an action line that specifies a program always have to end in a backslash, even if the underlying shell would not need or want the backslash to indicate continuation. This is due to the two pass parsing process needed (first procmail, then the shell (or not, depending on .BR SHELLMETAS )). .PP Don't put comments on the regular expression condition lines in a recipe, these lines are fed to the internal egrep .I literally (except for continuation backslashes at the end of a line). .PP Leading whitespace on continued regular expression condition lines is usually ignored (so that they can be indented), but .B not on continued condition lines that are evaluated according to the .BR sh (1) substitution rules inside double quotes. .PP Watch out for deadlocks when doing unhealthy things like forwarding mail to your own account. Deadlocks can be broken by proper use of .BR LOCKTIMEOUT . .PP Any default values that procmail has for some environment variables will .B always override the ones that were already defined. If you really want to override the defaults, you either have to put them in the .B rcfile or on the command line as arguments. .PP Environment variables set .B inside the shell-interpreted-`|' action part of a recipe will .B not retain their value after the recipe has finished since they are set in a subshell of procmail. To make sure the value of an environment variable is retained you have to put the assignment to the variable before the leading `|' of a recipe, so that it can capture stdout of the program. .PP If you specify only a `h' or a `b' flag on a delivering recipe, and the recipe matches, then, unless the `c' flag is present as well, the body respectively the header of the mail will be silently lost. .SH "SEE ALSO" .na .nh .BR procmail (1), .BR procmailsc (5), .BR procmailex (5), .BR sh (1), .BR csh (1), .BR mail (1), .BR mailx (1), .BR binmail (1), .BR uucp (1), .BR aliases (5), .BR sendmail (8), .BR egrep (1), .BR grep (1), .BR biff (1), .BR comsat (8), .BR lockfile (1), .BR formail (1) .hy .ad .SH BUGS The only substitutions of environment variables that can be handled by procmail itself are of the type $name, ${name}, ${name:-text}, ${name:+text}, ${name-text}, ${name+text}, $#, $n, $$, $?, $_, $\- and $=; whereas $_ will be substituted by the name of the current rcfile, $\- by $LASTFOLDER and $= will contain the score of the last recipe. When the .B \-a or .B \-m options are used, "$@" will expand to respectively the specified argument (list); but only when passed as in the argument list to a program. .PP Procmail does not support the expansion of `~'. .PP A line buffer of length $LINEBUF is used when processing the .IR rcfile , any expansions .B have to fit within this limit; if they don't, behaviour is undefined. .PP If the global lockfile has a .I relative path, and the current directory is not the same as when the global lockfile was created, then the global lockfile will not be removed if procmail exits at that point (remedy: use .I absolute paths to specify global lockfiles). .PP A locallockfile on the recipe that marks the start of a nested block does not work as expected. .PP When capturing stdout from a recipe into an environment variable, exactly one trailing newline will be stripped. .SH MISCELLANEOUS If the regular expression contains `\fB^TO\fP' it will be substituted by .na .nh `\fB(^((Original-)?(Resent-)?(To\h'-\w' 'u' |Cc\h'-\w' 'u' |Bcc)\h'-\w' 'u' |(X-Envelope\h'-\w' 'u' |Apparently(-Resent)?)-To)\h'-\w' 'u' :(.*[^a-zA-Z])?)\fP', which should catch all destination specifications. .hy .ad .PP If the regular expression contains `\fB^FROM_DAEMON\fP' it will be substituted by .na .nh `\fB(^(Precedence\h'-\w' 'u' :.*(junk\h'-\w' 'u' |bulk\h'-\w' 'u' |list)\h'-\w' 'u' |(((Resent-)?(From\h'-\w' 'u' |Sender)\h'-\w' 'u' |X-Envelope-From)\h'-\w' 'u' :\h'-\w' 'u' |>?From )(.*[^(.%@a-z0-9])?(Post(ma?(st(e?r)?\h'-\w' 'u' |n)\h'-\w' 'u' |office)\h'-\w' 'u' |(send)?Mail(er)?\h'-\w' 'u' |daemon\h'-\w' 'u' |mmdf\h'-\w' 'u' |root\h'-\w' 'u' |n?uucp\h'-\w' 'u' |smtp\h'-\w' 'u' |response\h'-\w' 'u' |LISTSERV\h'-\w' 'u' |owner\h'-\w' 'u' |request\h'-\w' 'u' |bounce\h'-\w' 'u' |serv(ices?\h'-\w' 'u' |er)\h'-\w' 'u' |Admin(istrator)?)([^).!\h'-\w' 'u' :a-z0-9].*)?$[^>]))\fP', which should catch mails coming from most daemons (how's that for a regular expression :\-). .hy .ad .PP If the regular expression contains `\fB^FROM_MAILER\fP' it will be substituted by .na .nh `\fB(^(((Resent-)?(From\h'-\w' 'u' |Sender)\h'-\w' 'u' |X-Envelope-From)\h'-\w' 'u' :\h'-\w' 'u' |>?From )(.*[^(.%@a-z0-9])?(Post(ma(st(er)?\h'-\w' 'u' |n)\h'-\w' 'u' |office)\h'-\w' 'u' |(send)?Mail(er)?\h'-\w' 'u' |daemon\h'-\w' 'u' |mmdf\h'-\w' 'u' |root\h'-\w' 'u' |n?uucp\h'-\w' 'u' |smtp\h'-\w' 'u' |response\h'-\w' 'u' |serv(ices?\h'-\w' 'u' |er)\h'-\w' 'u' |Admin(istrator)?)([^).!\h'-\w' 'u' :a-z0-9].*)?$[^>])\fP' (a stripped down version of `\fB^FROM_DAEMON\fP'), which should catch mails coming from most mailer-daemons. .hy .ad .PP When assigning boolean values to variables like VERBOSE, DELIVERED or COMSAT, procmail accepts as true every string starting with: a non-zero value, `on', `y', `t' or `e'. False is every string starting with: a zero value, `off', `n', `f' or `d'. .PP If the action line of a recipe specifies a program, a sole backslash-newline pair in it on an otherwise empty line will be converted into a newline. .SH NOTES Since unquoted leading whitespace is generally ignored in the rcfile you can indent everything to taste. .PP The leading `|' on the action line to specify a program or filter is stripped before checking for $SHELLMETAS. .PP Files included with the INCLUDERC directive containing only environment variable assignments can be shared with sh. .PP For .I really complicated processing you can even consider calling .B procmail recursively. .Sh AUTHOR Stephen R. van den Berg at RWTH-Aachen, Germany .Rs berg@pool.informatik.rwth-aachen.de .\" @MY_ALT_MAIL_ADDR@ .Re .\".if n .pl -(\n(.tu-1i) 0707010000fb07000081a400000064000000640000000132f511b700001f36000000200000001b00000000000000000000001c00000004reloc/man/man5/procmailsc.5.\"if n .pl +(135i-\n(.pu) .de Id .ds Rv \\$3 .ds Dt \\$4 .. .Id $Id: procmailsc.man,v 1.10 1994/10/07 15:24:32 berg Exp $ .TH PROCMAILSC 5 \*(Dt BuGless .rn SH Sh .de SH .br .ne 11 .Sh "\\$1" .. .rn SS Ss .de SS .br .ne 10 .Ss "\\$1" .. .rn TP Tp .de TP .br .ne 9 .Tp \\$1 .. .rn RS Rs .de RS .na .nf .Rs .. .rn RE Re .de RE .Re .fi .ad .. .de Sx .PP .ne \\$1 .RS .. .de Ex .RE .PP .. .na .SH NAME procmailsc \- procmail weighted scoring techique .SH SYNOPSIS .RB [ * ] .B "w^x condition" .ad .SH DESCRIPTION In addition to the traditional true or false conditions you can specify on a recipe, you can use a weighted scoring technique to decide if a certain recipe matches or not. When weighted scoring is used in a recipe, then the final score for that recipe must be positive for it to match. A certain condition can contribute to the score if you allocate it a `weight' .RB ( w ) and an `exponent' .RB ( x ). You do this by preceding the condition (on the same line) with: .RS .B w^x .RE Whereas both .B w and .B x are real numbers between \-2147483647.0 and 2147483647.0. .SH "Weighted regular expression conditions" The first time the regular expression is found, it will add .I w to the score. The second time it is found, .I w*x will be added. The third time it is found, .I w*x*x will be added. The fourth time .I w*x*x*x will be added. And so forth. This can be described by the following concise formula: .Sx 4 n n k\-1 x \- 1 w * Sum x = w * \-\-\-\-\-\-\- k=1 x \- 1 .Ex It represents the total added score for this condition if .B n matches are found. Note that the following case distinctions can be made: .TP 8 x=0 Only the first match will contribute w to the score. Any subsequent matches are ignored. .TP x=1 Every match will contribute the same w to the score. The score grows linearly with the number of matches found. .TP 0 L .Ex will generate an additional score of: .Sx 4 x / M \e w * | \-\-\- | \e L / .Ex And: .Sx 1 * w^x < L .Ex will generate an additional score of: .Sx 4 x / L \e w * | \-\-\- | \e M / .Ex .PP In both cases, if L=M, this will add w to the score. In the former case however, larger mails will be favoured, in the latter case, smaller mails will be favoured. Although x can be varied to fine-tune the steepness of the function, typical usage sets x=1. .SH MISCELLANEOUS You can query the final score of all the conditions on a recipe from the environment variable .BR $= . This variable is set .I every time just after procmail has parsed all conditions on a recipe (even if the recipe is not being executed). .SH EXAMPLES The following recipe will ditch all mails having more than 150 lines in the body. The first condition contains an empty regular expression which, because it always matches, is used to give our score a negative offset. The second condition then matches every line in the mail, and consumes up the previous negative offset we gave (one point per line). In the end, the score will only be positive if the mail contained more than 150 lines. .Sx 5 :0 Bh * \-150^0 * 1^1 ^.*$ /dev/null .Ex Suppose you have a priority folder which you always read first. The next recipe picks out the priority mail and files them in this special folder. The first condition is a regular one, i.e. it doesn't contribute to the score, but simply has to be satisfied. The other conditions describe things like: john and claire usually have something important to say, meetings are usually important, replies are favoured a bit, mails about Elvis (this is merely an example :\-) are favoured (the more he is mentioned, the more the mail is favoured, but the maximum extra score due to Elvis will be 4000, no matter how often he is mentioned), lots of quoted lines are disliked, smileys are appreciated (the score for those will reach a maximum of 3500), those three people usually don't send interesting mails, the mails should preferably be small (e.g. 2000 bytes long mails will score \-100, 4000 bytes long mails do \-800). As you see, if some of the uninteresting people send mail, then the mail still has a chance of landing in the priority folder, e.g. if it is about a meeting, or if it contains at least two smileys. .Sx 11 :0 HB * !^Precedence:.*(junk|bulk) * 2000^0 ^From:.*(john@home|claire@work) * 2000^0 ^Subject:.*meeting * 300^0 ^Subject:.*Re: * 1000^.75 elvis|presley * \-100^1 ^> * 350^.9 :\-\e) * \-500^0 ^From:.*(boss|jane|henry)@work * \-100^3 > 2000 priority_folder .Ex If you are subscribed to a mailinglist, and just would like to read the quality mails, then the following recipes could do the trick. First we make sure that the mail is coming from the mailinglist. Then we check if it is from certain persons of whom we value the opinion, or about a subject we absolutely want to know everything about. If it is, file it. Otherwise, check if the ratio of quoted lines to original lines is at most 1:2. If it exceeds that, ditch the mail. Everything that survived the previous test, is filed. .Sx 15 :0 ^From mailinglist-request@some.where { :0: * ^(From:.*(paula|bill)|Subject:.*skiing) mailinglist :0 Bh * 20^1 ^> * \-10^1 ^[^>] /dev/null :0: mailinglist } .Ex For further examples you should look in the .BR procmailex (5) man page. .SH CAVEATS Because this speeds up the search by an order of magnitude, the procmail internal egrep will always search for the leftmost .I shortest match, unless it is determining what to assign to .BR MATCH , in which case it searches the leftmost .I longest match. E.g. for the leftmost .I shortest match, by itself, the regular expression: .TP .B .* will always match a zero length string at the same spot. .TP .B .+ will always match one character (except newlines of course). .SH "SEE ALSO" .na .nh .BR procmail (1), .BR procmailrc (5), .BR procmailex (5), .BR sh (1), .BR csh (1), .BR egrep (1), .BR grep (1), .hy .ad .SH BUGS If, in a length condition, you specify an .B x that causes an overflow, procmail is at the mercy of the .BR pow (3) function in your mathematical library. .PP Floating point numbers in `engineering' format (e.g. 12e5) are not accepted. .SH MISCELLANEOUS As soon as `plus infinity' (2147483647) is reached, any subsequent .I weighted conditions will simply be skipped. .PP As soon as `minus infinity' (\-2147483647) is reached, the condition will be considered as `no match' and the recipe will terminate early. .SH NOTES If in a regular expression weighted formula .BR 0