procmail
[Top] [All Lists]

bouncing emails without real names

2003-03-01 22:26:24
Does anyone have a good recipe for bouncing e-mails
from people who don't give their real name in the From: line?
I'm a teacher, and I'm tired of nagging my students not to send
me e-mails from addresses like ppkaka(_at_)aol(_dot_)com (no, I'm not
making that one up!) with no real name listed, and
expect me to know who they are.

The code below is what I came up with, but after a little
testing I soon realized it wasn't going to do the job.
(The code for replying is lifted from Timo Salmi's page.)

Typically the From line should be like
  "xxx xxx" <xxx(_at_)xxx(_dot_)xxx>   ,
but some businesses don't have any blank in the real name,
  "xxxxxx" <xxx(_at_)xxx(_dot_)xxx>   ,
and I've also seen some emails like this:
   X-Sender: foo(_at_)bar(_dot_)com
   From: mailroom(_at_)bar(_dot_)com (Mailroom)
which I suppose I'd like to accept.

When I was trying to test my code, I made up a yahoo.com
address so I could send e-mail to myself. (Didn't want to test
by sending mail from my normal address to my normal address,
since that could create a loop.) In fact, I found out that
Yahoo makes it very difficult to commit this particular faux
pas. However, I have seen quite a few of these addresses coming
from ISPs like AOL and Excite. I'm thinking that the right solution
might be simply to restrict the blocking to e-mails coming from those
ISPs. That way there'd be less risk of blocking things I shouldn't
block, and also I'd imagine that all aol.com headers are fairly
uniform in their structure.

One would want to structure things so that this kind of bounce happens
only to e-mails we're pretty sure are not spam.

:0
* ! ^From:[ ]*"[^"]+ [^"]+" (<)?[a-z0-9_]+@([a-z0-9_]+\.)+[a-z0-9_]+>?$
#
* ! ^From:.*mydomain
* ! ^X-Loop:.*mydomain
#
{
  # Make a temporary file of the message to be returned
  :0c:formail.lock
  # Discard whitespaces, insert a leading blank
  | expand | sed -e 's/[ ]*$//g' | sed -e 's/^/ /' > return.tmp
  # Prepare and send the rejection
  :0:formail.lock
  | (formail -r -I"Subject: Rejected mail: Recipient refusal" \
    -A"X-Loop: rejected-mail(_at_)mydomain(_dot_)com" ; \
    echo "Sorry, but your e-mail was rejected because the From: header" ; \
    echo "didn't seem to include your real name. This is an automated message; 
replying" ; \
    echo "to it won't work." ; \
    echo "--- begin rejected mail ---" ; \
    cat return.tmp ; \
    echo "--- end rejected mail ---" ; \
    rm -f return.tmp) \
    | /usr/sbin/sendmail -t
}



__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>