PMG AI integration

antonin.chadima

Active Member
Sep 22, 2021
34
8
28
51
Hi,

this feature would be an absolute game changer.
I would like to have a functionality in PMG like the ThunderAI for Thunderbird (just the analyze for spam part).
https://github.com/micz/ThunderAI

It should pass the message to an AI LLM model and combine the result with the SpamAssassin scores.

Prompt text something like this:
Code:
Analyze the following email and determine if it is spam or not. Consider factors such as suspicious keywords, excessive promotional language, misleading subject lines, requests for personal information, and unusual sender addresses.
Provide a value from 0 (not spam) to 100 (spam) and an explanation of no more than 10 words.
In case of missing message data, set the value to 0 (not spam), and give the reason.
Generate a response in JSON format only. Do not include any additional text or explanation; provide only the JSON. Here is the format to be used:
{
"spamValue": <integer from 0 to 100>,
"explanation": "Brief explanation of your reasoning"
}
Here there are the mail information:
Sender: "{%author%}"
Subject: "{%mail_subject%}"
Html body: "{%mail_html_body%}"

You should have ability to change the weight of the AI scores.
And setup for the connection to a LLM model (OpenAI API etc...).

It should be really easy to implement.
We have a great experience with ThunderAI but not everybody uses Thunderbird...
 
Last edited:
  • Like
Reactions: george le

just an output of my daily spam fight ;-)
 
  • Like
Reactions: george le
I wrote one, too.
It is integrated during the last check of spamassassin to prevent unneccessary scanning.

 
My solution support local ollama models. You just need a graphic card to run an LLM with enough deciding power.

My solution supports only sending unclassified "on the fence" mails to AI – this is a core design feature, because AI is – as you said – one of the most time and operational cost consuming scanner/filter.

I understand the data protection concern, but i also understand, why people do not want to deliver spams, but classify those mails beforehand.

You can just send the subject, and if you send the body, you cut the first 3 - 5 lines of text instead of send the full body. This combined with only checking 5 % of your mail volume, the "on the fence" mails is a fair trade off.
 
Last edited:
  • Like
Reactions: AlexHK