procmail
[Top] [All Lists]

Re: How to notify another e-mail address

2000-12-15 11:37:37
(got both copies, thanks!)

At 12:22 2000-12-15 +0100, Harry Jensen wrote:

How can i send a notify message to another e-mail address about that I've got mail from someone.

I'm going to assume that you're probably sending this to a text-enabled pager or the account which is being emailed is really low volume - otherwise, why not set up a plain forward or a fetchmail process from the remote account and just pull the email on over to where you regularly read mail...

I cannot find any examples regarding this,

Huh, that's a surprise - I'd have thought the archives to be teeming with them.

I cannot find information on what your config is (or even if it is installed on your system, configured as the LDA, etc), and whether you have _any_ experience with procmail.

i.e. is this supposed to be a "tell me which file to put where" , or just the raw recipe. I'll give you just the raw recipe, since the rest of this should be readily available by reading the man pages and the various FAQs.

Take "from" address and name.

FROM, SENDER, or REPLY-TO ?  All often referred to as "from" by some folks.

Send a notification to my_other_address(_at_)another_isp(_dot_)dk(_dot_)
The note should be: "You've got mail from " + from_e-mail_address + from_name.

For the sake of such notification, unless you have a database of names & addresses (to deal with all those instances where someone may just send mail without a name), you may just as well send the whole darn "From:" header.

# big block of "get these items into variables because we like to
# use them so often and they're easier to manage this way."
# you don't need all of these (just the $FROM in fact), but this is
# simply a nice thing to have in the procmailrc for any other recipes
# anyway...
:0
{
        :0
        * ^Subject:[    ]*\/[^  ].*
        {
                SUBJECT=$MATCH
        }
        :0
        * ^To:[         ]*\/[^  ].*
        {
                TO=$MATCH
        }
        :0
        * ^From:[       ]*\/[^  ].*
        {
                FROM=$MATCH
        }

        # Here we have to call shell.... -rt will parse return address
        # according to RFC rules.  Note we only process HEADER.
        # SENDER=|$FORMAIL -rtzxTo:
        :0 h
        SENDER=|$FORMAIL -b -rtzxTo:
}

# now, the following is patently untested, so I advise that you test it in
# a manually-invoked procmail environment where you pipe a few messages
# at it first.

$MYOTHERADDRESS=my_other_address(_at_)another_isp(_dot_)dk
$XLOOP=thisaddress(_at_)this_isp(_dot_)tld

# presumably ALL messages get forwarded.  'cept of course those which
# are determined to be loops and DAEMON messages
:0ih
* $! ^X-Loop: $XLOOP
* !^FROM_DAEMON
| ( \
    echo "To: $MYOTHERADDRESS"; \
    echo "From: $XLOOP (notification)"; \
    echo 'Subject: New mail notification'; \
    echo "X-Loop: $XLOOP"; \
    echo ; \
    echo "You've got mail from $FROM"; \
   ) | $SENDMAIL $SENDMAILFLAGS $MYOTHERADDRESS

---
 Please DO NOT carbon me on list replies.  I'll get my copy from the list.

 Sean B. Straw / Professional Software Engineering
 Post Box 2395 / San Rafael, CA  94912-2395

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