Showing results for 
Search instead for 
Did you mean: 

archiving / forwarding mails sent from one user id....

Honored Contributor

archiving / forwarding mails sent from one user id....


I have got an HPUX 11i server running sendmail as the MTA. This is a pop3/smtp server. Users use outlook express configured in windows client to send and receive email. I want to archive / auto forward the mails a particular user sends...
something like inserting an automatic bcc or cc!!
something sort of the reverse of ".forward" method!!!
how can i accomplish this?? any setting/configuration in would help??

awaiting your replies

with regards
practice makes a man perfect!!!
Geoff Wild
Honored Contributor

Re: archiving / forwarding mails sent from one user id....

Have a look at mimedefang:

In the sendmail faq:
Subject: Q4.20 -- How can I automatically copy messages based on sender or recipient addresses?
Date: June 30, 2000
Updated: February 27, 2001
Updated: June 5, 2001
Updated: February 13, 2003
It would require custom programming. You could either write a mail filter using the new Milter API in sendmail 8.10 and later (see libmilter/README) or you could look at some of these other unsupported hints:

Axel Reinhold's logall.c module
Message-Id: <>
the procmailrc man page
Note that no such feature has been added to sendmail. When asked about this one of the sendmail developers said it was "because we still believe a bit in privacy."

Found this on google:

Milter does the trick for me. I've found very little info on using Milter
save for these;

and this crucial tip regarding the fact you must "register" SMFIF_ADDRCPT in
the flags field;

The EOM callback is where I do it also, so it may be the flags field
in the smfiDesc structure. It took me a long while to realize that I
had to tell it using the SMFIF_ADDRCPT (see below) that I may be
calling smfi_addrcpt. Once I did that, my problems seemed to clear

struct smfiDesc smfilter =
"gsmilter", /* filter name */
SMFI_VERSION, /* version code -- do not change */
NULL, /* connection info filter */
NULL, /* SMTP HELO command filter */
mlfi_envfrom, /* envelope sender filter */
mlfi_envrcpt, /* envelope recipient filter */
mlfi_header, /* header filter */
mlfi_eoh, /* end of header */
mlfi_body, /* body block filter */
mlfi_eom, /* end of message */
mlfi_abort, /* message aborted */
mlfi_close /* connection cleanup */

I've installed a milter that simply adds a recipient to all email messages
by calling smfi_addrcpt in the mlfi_eom callback. I add my own email address
as the recipient. For messages which I am sending out to others, this has
the effect of BCC'ing myself on everything I send out. Then I use procmail
to file it into appropriate places. I.e. I don't have these appear in my
"Inbox", I only file them away for keepsake. Then for messages which others
send to me, I am added as a recipient but, apparently, since I'm already a
recipient I do not get an "extra" copy. Which is just the functionality I
was after.

Another method I tried but couldn't get to work is this method
which used to be at

$ cat copyuser.m4
VERSIONID(`copyuser.m4 November 15, 1999')dnl
VERSIONID(`Copyright 1999, Robert Harker, Harker Systems')dnl
VERSIONID(`,, 408-295-6239')dnl
VERSIONID(`Permission granted to use this as long as this')dnl
VERSIONID(`VERSIONID information is preserved in the M4 macro file')dnl
VERSIONID(`and any files created using this M4 macro file')dnl

`errprint(`*** MAILER(smtp) must appear before copymail


# added by `LOCAL_RULE_0'
# `LOCAL_RULE_0' is used rather than `LOCAL_NET_CONFIG' so that
# we do the copymail delivery before virtusertable,
# mailertable, or bestmx delivery
# see
R$+<@$+.NOCOPY.> $#esmtp $@$2 $:$1<@$2.>
R$+<@$+.> $#copymail $@nohostneeded $:$1<@$2.NOCOPY>
R$+<@$+> $#copymail $@nohostneeded $:$1<@$2.NOCOPY>

# Copy a message by sending it back to sendmail with an additional address:
# copyuser
Mcopymail, P=/usr/lib/sendmail, F=fmSDFMu,
S=11/31, R=ifdef(`_ALL_MASQUERADE_', `21/31', `21'),
A=sendmail -C /tmp/ copyuser $u
### end of copyuser.m4 ###

Here's a link to copyuser.m4:


Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.