You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Nathaniel Dell <nd...@setcorporation.com> on 2006/01/25 15:31:44 UTC

Notification when user sends email

Is it possible to receive a notification when a user sends a emai to anyone
in the company? I need to implement something like this.

Help would be greatly appreciated!!


RE: Notification when user sends email

Posted by Nathaniel Dell <nd...@setcorporation.com>.
Will this do the same thing? 


-----Original Message-----
From: Dale Morin [mailto:dale@MustangInternetServices.com] 
Sent: Wednesday, January 25, 2006 12:01 PM
To: users@spamassassin.apache.org
Cc: Nathaniel Dell
Subject: Re: Notification when user sends email

Hello,

You will need to modify it where I am extracting the username part of the
email address from the To: address.  That is
where you will want to examine the From: address instead.  Note that I am
altering the subject to insert the original
username in front of the subject so that messages in the bigbrother account
can be sorted by their original recipients.
 Note that this recipe will need to be in /etc/procmailrc so that it is
processed for all incoming messages.

Hope this helps.


SHELL=/bin/sh
LOGFILE=/var/log/procmail.log
TODAY=`date +%Y-%m-%d`
#VERBOSE=yes

# forward a copy of all incoming messages
:0
* ^TO_*@mynosydomain.com
* ! ^X-Loop: mynosydomain\.com
{
# extract subject
  SUBJECT=`formail -cxSubject:`
# get the To: address without comments
  :0h:
  CLEANTO=|formail -cxTo:
  # username portion
  :0:
  * CLEANTO ?? ^\/[^@]+
  {
    TO_USER=$MATCH
  }
# insert X-Loop header
  :0fwh:
  | formail -A "X-Loop: mynosydomain.com"
# deliver the original
  :0c:
  ${DEFAULT}
# alter the subject
  :0fw:
  | formail -i "Subject: [$TO_USER] $SUBJECT"
# deliver the copy with the altered subject
  :0:
  ! bigbrother@mynosydomain.com
}

Dale



Re: Notification when user sends email

Posted by Dale Morin <da...@MustangInternetServices.com>.
Hello,

You will need to modify it where I am extracting the username part of the email address from the To: address.  That is
where you will want to examine the From: address instead.  Note that I am altering the subject to insert the original
username in front of the subject so that messages in the bigbrother account can be sorted by their original recipients.
 Note that this recipe will need to be in /etc/procmailrc so that it is processed for all incoming messages.

Hope this helps.


SHELL=/bin/sh
LOGFILE=/var/log/procmail.log
TODAY=`date +%Y-%m-%d`
#VERBOSE=yes

# forward a copy of all incoming messages
:0
* ^TO_*@mynosydomain.com
* ! ^X-Loop: mynosydomain\.com
{
# extract subject
  SUBJECT=`formail -cxSubject:`
# get the To: address without comments
  :0h:
  CLEANTO=|formail -cxTo:
  # username portion
  :0:
  * CLEANTO ?? ^\/[^@]+
  {
    TO_USER=$MATCH
  }
# insert X-Loop header
  :0fwh:
  | formail -A "X-Loop: mynosydomain.com"
# deliver the original
  :0c:
  ${DEFAULT}
# alter the subject
  :0fw:
  | formail -i "Subject: [$TO_USER] $SUBJECT"
# deliver the copy with the altered subject
  :0:
  ! bigbrother@mynosydomain.com
}

Dale

RE: Notification when user sends email

Posted by Nathaniel Dell <nd...@setcorporation.com>.
This sounds like exactly what I need. Any pointers to where I can find
documentation on how to do this? 
Thanks for all your help on this!
Nate

-----Original Message-----
From: Dale Morin [mailto:dale@MustangInternetServices.com] 
Sent: Wednesday, January 25, 2006 10:40 AM
To: users@spamassassin.apache.org
Subject: Re: Notification when user sends email

Hello,

Yes, it can be done fairly easily using procmail.

We have a client that has a copy of every incoming email forwarded to
another account.  My personal objections to Big
Brother aside, it works nicely.  Modifying that recipe so that it fires only
when the From: address is foo@foo.bar is
trivial.

Dale



Re: Notification when user sends email

Posted by Dale Morin <da...@MustangInternetServices.com>.
Hello,

Yes, it can be done fairly easily using procmail.

We have a client that has a copy of every incoming email forwarded to another account.  My personal objections to Big
Brother aside, it works nicely.  Modifying that recipe so that it fires only when the From: address is foo@foo.bar is
trivial.

Dale

Re: Notification when user sends email

Posted by Matt Kettler <mk...@comcast.net>.
Nathaniel Dell wrote:
>
> Is it possible to receive a notification when a user sends a emai to
> anyone in the company? I need to implement something like this.
>
> Help would be greatly appreciated!!
>
Sounds like a job for swatch or logsurfer.

These tools are designed to watch your logs for events matching a regex
and trigger a script (such as sending an email) when a matching line
appears.