#!/usr/bin/env python # Produce a sentence on stdout saying something about the message on stdin. # ats@offog.org import sys import rfc822 import string import re msg = rfc822.Message(sys.stdin, 0) (fromname, fromemail) = msg.getaddr("From") subj = msg.getheader("Subject") sent = "You've got new mail from " if fromname: sent = sent + fromname else: sent = sent + string.replace(fromemail, "@", " at ") if subj: sent = sent + "; about " + subj print sent + "."