2

in the company I work for there are a user that is making bad use of the email, but to have evidence of what he is doing we need to intercept all the incoming email to him and all outgoing email from him, I am the mail server administrator, I have sendmail running on ubuntu.

Is it possible to catch all his email, store it to another email account and then deliver the email to the original recipient with sendmail ?

For example, all the email to baduser@mycompany.com must be stored on another account (spy@mycompany.com) and then deliver it to him (baduser@mycompany.com).

All the email from baduser@mycompany.com must be stored to another account (spysent@mycompany.com) and then send it to the recipient.

I appreciate your help.

Thank you so much.

oware
  • 121
  • 4

1 Answers1

0

Most email services have a built-in blind carbon copy (BCC:) function. Using this function will cause the server to make a duplicate of the email and send it to the address that is specified; the regular message continues to be delivered to the user.

I haven't touched sendmail in years, but I know for certain that postfix has this feature.


It took some doing but I found this thread, which discusses alterations to sendmail's configuration to achieve what you are after. It also gives a link to sendmail's use of m4.

Avery Payne
  • 14,536
  • 1
  • 51
  • 88
  • 1
    thanks, that solves the sent mail from the user, but what about the incoming mail to the user? (that is what we are more interested) and, I can't switch to postfix because it is a production server... – oware Mar 10 '15 at 20:16
  • 1
    Email aliases can handle incoming mail. It should be possible to add an alias that copies the email to a second address. – BillThor Mar 10 '15 at 20:43
  • Email aliases should be a last resort. If there is a NDN or bounce, then the headers will have... – Avery Payne Mar 10 '15 at 22:45
  • Unfortunately auto-bcc is not a built-in feature for SendMail. It can be done with additional milters (for example [milter-bcc](http://www.snertsoft.com/sendmail/milter-bcc/)). For additional details, please see [here](http://www.sendmail.com/sm/open_source/support/support_faq/general_issues_faq/#4.20). – Mike B Mar 10 '15 at 22:54
  • milter-bcc looks like a good approach, I will try it. I have used virtual users but the email doesn't arrive to the original recipient, I have not tried aliases yet, I will try them too and if I found what I want I will post it – oware Mar 12 '15 at 16:00