Exim autoCC functionality with .forward file

glarkin

Verified User
Joined
Apr 27, 2004
Messages
24
Hi all,

A client of ours (assume his domain is mydomain.net) requested that we set up autoCC functionality for all of his POP3 email accounts. He created a backup account ([email protected]) where he would like all other incoming emails for his domain to be copied.

I created the following .forward file in his UNIX user home directory:


# Exim filter <<== do not edit or remove this line!
#
# This is a "magic comment" that must not be removed.
#

#
# The Exim document (http://www.exim.org/docs/filter.html)
# strongly recommends the following command as the first filter command:
# it prevents delivery error reports going round and round in loops:
#
if error_message then finish endif

#
# Insert any pre-spam filtering rules here. For example, you might
# be on a mailing list whose messages are sometimes mistaken for spam,
# and want to deal with those messages before the spam rule.
#
logfile /tmp/exim-filter.log
logwrite "Message ID $message_id processed - sent to $header_to:"

#
# SpamAssassin filtering rule goes here
# [see http://www.doc.ic.ac.uk/csg/faqs/email/spam/ for details]
#

#
# Insert any post-spam filtering rules here.
# If it gets this far, SpamAssassin says it's not spam
#
if $header_to: does not contain "[email protected]"
then
unseen deliver [email protected]
endif

#
# When on vacation - setup .vacation.msg; clear .vacation.{dir,pag} and
# uncomment the following line.
#
#unseen pipe "/usr/bin/vacation $local_part"


I tested the file format with the command:

/usr/sbin/sendmail -bf /home/mydomain/.forward < testmessage.txt

and that seemed to work.

Exim does not seem to be invoking this .forward file. I checked the /etc/exim.conf file, and I see this:


userforward:
driver = redirect
allow_filter
check_ancestor
check_local_user
no_expn
file = $home/.forward
file_transport = address_file
pipe_transport = address_pipe
reply_transport = address_reply
no_verify


It looks like the .forward file in the UNIX home directory should be invoked at mail delivery time. Can anyone tell me why that's not the case?

Thank you,
Greg Larkin
 
As is often the case, I found a solution after I posted a question to a bulletin board!

For anyone that's interested, DA keeps its Exim filters in /etc/virtual/|DOMAIN|/filter. I created a template filter to work with by blocking email address "[email protected]" in the DA UI. Then I just pasted my filter into that file. That did the trick!

Unfortunately, I had to do "chmod u-w filter" to prevent someone from removing my filter by changing settings in the DA UI. The filter file will be rewritten by DA whenever the filter settings are updated. At least with my permission hack, a message on the screen will show that the file could not be modified.

If anyone has a more elegant solution, I'd like to hear it.

Thanks,
Greg
 
Back
Top