Reject Email Based On Subject Line?

I have been running a sendmail mail server on Slackware for years and but since Pat V. has moved away from sendmail, it is getting to be more and more of a hassle to keep it up to date and integrating it with DKIM, TLS, DNSBLs, AV etc. This is mostly because I do not interact with it frequently enough so I always seems to be reinventing the wheel and working out “gotchas”. In any case, I have been thinking about looking at Mail-in-a Box as an alternative . The one feature I would really miss however is that sendmail provides me with the ability to reject email based on the subject line right at the front door so that there is no back scatter. Is this also possible with Mail-in-a-Box?

Is this necessary to be a rule for the entire server, or can it be on a per-user account?

Mailinabox includes managesieve. Perhaps you can achieve what you want with Sieve rules.

It could be either. With sendmail it is server based so it applies to all incoming mail regardless of recipient. In this case, I cannot imagine any user would want the email so server wide is not a problem. At least there have been no complaints.about the mail not being received.

You can use Roundcube to make per-user rules.

If you want the rules to be for the server, then you will need to figure out your own unsupported modification to postfix.

@latinhypercube

I looked at a few references on the web about ManageSieve, and it appears that it acts on mail after it has been accepted. I know it is petty, but I would really like the mail to not even be accepted so that there is an indication in the sender’s logs that the email has been treated as spam and rejected. The sender is so big the logs are probably never even checked, but it at least does my heart good. I would add the domain to sendmail’s access.db, but there is legitimate email that needs to be accepted from the same domain.

@openletter

Based on what I could find out, RoundCube appears to be more of a web based client since it still needs an SMTP server. I also have users that use clients such as Outlook so they would not be very happy with a web based client. I personally still use text based Pine, now.Alpine, but then I have been told I am a dinosaur. ::wink:

Roundcube is a webclient, but the rules interface with the ManageSieve feature of Dovecot, so when rules are configured they are applied even if the user never uses Roundcube otherwise.

Thanks for the clarification. I did not see that on the RoundCube web site.

If I have not yet worn out my welcome, do you know if such a rule would simply filter out the email between receiving server and the user, or does it actually reject it so it never lands on the receiving server, i.e., the sending server receives a 554 .5.7.1 message.

Fair enough. Perhaps you could use Postfix filter rules then.

Postfix filter before queue and overview of filters for how. This can achieve what you want and refuse receipt of the mail item. Unsupported use of MIAB though.

MIAB architecture diagram may help to understand mail flow and where you might intervene. Postfix is the mail transfer agent in MIAB equivalent to Sendmail in your prior experience.