On Mon, 2022-04-04 at 01:45 +0200, Matija Nalis wrote: > On Mon, Apr 04, 2022 at 12:19:23AM +0100, Martin Gregorie wrote: > > For instance, I whitelist any email sender who I've previously sent > > mail > > to. To do this I maintain am email archive held in a PostgreSQL > > database and wrote an SA plugin that searches the archive for any > > message(s) I've previously sent to the sender of the message being > > checked: if I've sent mail to them they get whitelisted. > > That sounds interesting, is it published somewhere? > https://www.libelle-systems.com/mailarchive/
The mail archive schema may suit you or not, but that's not very important since the SA plugin uses an SQL view to check whether I've ever sent mail to the sender of a message I've received: if you don't want a mail archive you could use a single table database with the table containing same columns and indices as my SQL View. More important points: - I use Postscript's BCC facility to send copies of every mail I send or receive to a mail queue and a daily cron job to load the contents of this queue into the database. - The loader program is written in Java and will need modification (read simplification) if you don't want a mail archive. In this case I assume that you'd replace the SQL View with an equivalent table as described above and rewrite the MAloader program so that it only adds unrecorded outbound mail addresses to the new table. - The loader and a couple of interactive programs are also written in Java. These: - search the database and optionally send copies of archived mail to a nominated local MUA - remove unwanted mail from the database These are not needed if you don't want a mail archive. - I retrieve mail from my inbox at my ISP using getmail plus a small C program which passes mail to SA, accepts the mail as returned by MA and uses the spam score to decide whether to quarentine it or pass it to Postfix for delivery. You don't need to use getmail if you let your local MTA retrieve mail from your ISP, but you'd still want to run a local MTA, preferably Postfix, so it can pass incoming mail though SA, quarentine of discard spam and you can use its BCC facility to send copies of incoming and outgoing mail to the loader's input queue. - Postfix delivers outgoing mail directly to my ISP's outbox. Martin