I use an alias for each company that I provide an e-mail contact. So, for example, in /etc/aliases
somecompany: myuser
The address I supply to SomeCompany would be somecompany@mydomain.com
If the sender's domain is not from somecompany.com
, then I can assume it's spam.
Is it possible for sendmail (or another method) to automate checking that the domain matches the alias, else reject the mail?
Following from the answer of @MERM, which suggests the use of procmail
, we can create a rule like this: -
:0:
* ^TOsomecompany
* !^FROM.*somecompany.com
/dev/null
It's a good start, but suppressing the delivery is not as effective as the server rejecting it. Is it possible to request that sendmail rejects the mail, rather than simply forward to /dev/null
?