We have following e-mail topology:
Exchange server --------- Sendmail server ---------------Internet
On sendmail server there is no any user mailbox and messages with sender address [email protected]
can arrive only from exchange server and never from Internet.
Basing on this fact I want to limit amount of received spam by rejecting all emails incoming from Internet and claiming to be from my own domain ([email protected]
).
I have configured an SPF record for my domain and installed on sendmail server a spfmilter, spamassassin and spamass-milter packages. It works well, but there are two issues :
If during SMTP conversation sender specify bad address in "
MAIL FROM:
" command, it will be rejected, but sender can still issue another "MAIL FROM:
" command and if this second address will be accepted, whole messages will be accepted too. I prefer that sender should have no second chance and if he specify at last one address rejected by spfmilter, the whole message should be unconditionally rejected.If sender has specified valid addresses (accepted by spfmilter), it can issue
DATA
command and then put a line (as message body) like this "From: <[email protected]>
". This line is not a part of SMTP conversation but it becomes part of message header (my outlook display this address as a sender address). So I want configure an spamassassin filter test/rule, which will mark message as a spam (after DATA command it is already too late for rejecting message) if sender addresses given in message header don't match addresses specified as a part of SMTP conversation, but don't know how to do this.
Any suggestions?