# Sendmail diverting messages



## jem (Apr 23, 2013)

Hello.

I'm not too experienced with Sendmail, having been avoiding it like the plague over the years due to its needlessly complicated and incomprehensible configuration method.  I much prefer Postfix.

However I now find myself having to look after some production Sendmail relays and need to work out how to do something.

These relays are incoming mail gateways for my organisation, sitting between the big bad Internet and an internal MS Exchange platform.  From time to time our Information Security department asks us to divert incoming email from certain senders to them instead of relaying it to the Exchange platform and its intended recipient.

We're doing this in a somewhat clunky way at the moment, by using milter-regex to match the incoming mail by its sender address and quarantining it.  A nightly-run shell script then moves the queue files for the quarantined messages out of the queue directory, tars them up, then emails the tarball to InfoSec.

InfoSec are finding the Sendmail queue files difficult to work with though, split as they are into a Sendmail-specific control file and a data file.

Is there a way in which the email could simply be diverted as-is to a different address without being modified in any way?

Thanks for any advice.


----------



## DutchDaemon (Apr 23, 2013)

Why not use mail/procmail?


----------



## lbol (Apr 23, 2013)

AFAIK there is no way to divert messages in sendmail(8) directly based on sender address. So you have to stick with milter-regex

Your InfoSec people should not have to deal with sendmail-specific control files. It's all in the data files.


----------



## wblock@ (Apr 23, 2013)

mail/maildrop can have a /usr/local/etc/maildroprc that appears it might work on all incoming mail.  I have not tried that, only used it and mail/procmail for individual users.


----------



## jem (Apr 23, 2013)

DutchDaemon said:
			
		

> Why not use mail/procmail?



mail/procmail is a mail delivery agent.  These servers don't deliver; they just relay to another mail platform, so I don't know how this could be incorporated into the flow.




			
				lbol said:
			
		

> AFAIK there is no way to divert messages in sendmail(8) directly based on sender address. So you have to stick with milter-regex
> 
> Your InfoSec people should not have to deal with sendmail-specific control files. It's all in the data files.



Unfortunately, milter-regex can do many things but diverting mail isn't one of them.  Also, the sendmail() queue data file contains only the message body.  InfoSec will want the headers too, which are in the control file.  They do get sent both the files, but it's a pain for them to view the information within them.  Ideally they want to receive the email and be able to view it in their email client in its original form.


----------

