David W. Rankin, Jr.  Technical Support, Engineering Workstation Laboratory
   rankin@ewl.uky.edu   PGP Key via http://www.ewl.uky.edu/rankin/key.asc
       Alphanumeric Pager: rankin-pager@ewl.uky.edu or (606) 330-4922

# THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED.  IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# The following .procmailrc is used by the UK Engineering Workstation
# Laboratory to drive our pager interface. Typically called by a line
# like the following in /usr/lib/aliases:
#rankin-pager    : "| procmail -m /users/sendpage/page.procrc"
#
# Gives the full From: line for the message.
FULLFROM=`formail -xFrom:`

# The from address as provided by formail. Note, formail strips the pretty
# stuff automagically
FROM=`formail -rt -xTo: | sed -e 's/".*"//' -e 's/.*<//' -e 's/>.*//' -e "s/(.*)//"  -e 's/^ //' `

#Junk all replies from a pager gateway (even our own).
:0
* ^From: sendpage
/dev/null 

:0
* ^TOsysadm-pager
{
# Send a copy of the letter to the "regular" address.
	:0 c
	! sysadm@ewl.uky.edu

# This rule is pretty complicated. First, echo puts out a line telling the
# user who the page is even from. Next, formail strips the headers. Then,
# the two outputs get concatted together & fed to sendpage.
	:0 
	| (echo Page from $FULLFROM to sysadm-pager \:; formail -I "") |\
		/usr/local/bin/sendpage -f $FROM -m 5 nguyen-pager rankin-pager
}

:0
* ^TOrankin-pager
{
	:0 c
	| (echo Page from $FULLFROM to rankin-pager \:; formail -I "") |\
		/usr/local/bin/sendpage -f $FROM -m 5 rankin-pager

	:0 
	! rankin@ewl.uky.edu
}

:0
* ^TOnguyen-pager
{
	:0 c
	! nguyen@ewl.uky.edu

	:0 
	| (echo Page from $FULLFROM to nguyen-pager \:; formail -I "") |\
		/usr/local/bin/sendpage -f $FROM -m 5 nguyen-pager
}

:0
* ^TOtest-pager
{
	:0 c
	| (echo Page from $FULLFROM to test-pager \:; formail -I "") |\
		/usr/local/bin/sendpage -f $FROM -m 5 test-pager

	:0 
	! rankin@ewl.uky.edu
}

# I'm not really sure WHO this goes to, so bounce it back.
:0
* !^FROM_DAEMON
| ( formail -rt -A"Precedence: junk" -I"From: sendpage@ewl.uky.edu" ; \
	echo "The Pager Gateway does not recognize any given address"; \
	echo "that you listed in the message you sent to it." ) \
	| $SENDMAIL -t


