PDA

View Full Version : Notify another email address but do not forward.



zookie
06-11-2004, 10:28 AM
I have a client whose email I support on my WestHost server. They have another email address which they check much more regularly and they would like to receive a notification from my WestHost server telling them that a message has been delivered to their domain.

They do not want the message to be forwarded because they want to maintain separate email databases in their outlook client. They just want to be notified.

Example:
email sent to info@zcco.org should send a notification to notify@digisatsolutions.com

From my searches on this forum and the web, it appears that I need to do this with procmail, but I am not familiar with procmail and unsure where to go from here.

Any advice would be appreciated.

Thanks!

Zachary

FZ
06-11-2004, 02:31 PM
Here's one way of doing it (probably not the most efficient, but it works):

1. Make sure the e-mail/FTP account in question has a home directory assigned to it (check via your Site Manager). If it doesn't, give it one (can be any directory you want, or just accept the default).

2. Create a file called .procmailrc and place the following code in it:


:0c
| notify.sh

3. Create a file called notify.sh and place this code in it:


/bin/sendmail -t -f notifier@zcco.org << EOF
To: notify@digisatsolutions.com
From: "New e-mail notifier" <notifier@zcco.org>
Subject: New mail notification

You have new mail at info@zcco.org.
.
EOF


Edit as necessary, the e-mail addresses that appear in the code block above (and the subject and body, if necessary). Do not edit anything else (leave the . and EOF in, on their own lines).

NOTE: Make sure not to change the notifier@ e-mail addresses to info@ otherwise if the mail bounces, it could create an endless mail loop (not good). I recommend you either create a new e-mail account (notifier) just for this purpose, or you can change it to zcco@ or whatever other e-mail address you want (except info@).

4. Assuming the home directory for the account is /ftp/pub/info upload both of the above files into that directory, in ASCII mode. Then, CHMOD 644 .procmailrc and CHMOD 755 notify.sh

5. That's it - should be working now. Send yourself some test mail and watch for the notification. Keep in mind that this is a really primitive way of doing this: it will generate a notification for every single e-mail that arrives and has no built in error-checking or bounce-checking, etc.

zookie
06-11-2004, 10:52 PM
FZ, I can not thank you enough. I could not have asked for a better answer! This will work perfectly and it is a start for my tweaking if I want more complexity later.

Out of curiousity and because I am using SpamAssassin, will this notify script run before or after SpamAssassin has evaluated the message for SPAM content?


Thanks again!

Zachary

wildjokerdesign
06-12-2004, 06:43 AM
I'm not Fayez but I think it well run after SpamAssasin because if I understand right you can catch things that have beem marked by SA with Procmail i.e. if it has a certain SA score you can send it to a certain folder or even delete it.

FZ
06-12-2004, 09:06 AM
No problem, Zachary.

Shawn is right: it will run after the e-mail has been processed by SpamAssassin... That is the first thing that is done to all incoming mail (assuming you have SpamAssassin installed) by way of the "global" Procmail recipe (rules) which is run before any "local" (user-specific) Procmail recipe(s) (i.e. .procmailrc files in home directories, as is the case here).

SJP
06-13-2004, 04:30 PM
Excellent!

SJP

zookie
06-14-2004, 08:31 AM
Terrific! This solution is absolutely perfect for my needs.

Thank you all.

FZ
06-14-2004, 11:21 AM
Glad to have helped.