alphabox / spamc Goto Github PK
View Code? Open in Web Editor NEWA solid client in Java to communicate with SpamAssassin.
License: Apache License 2.0
A solid client in Java to communicate with SpamAssassin.
License: Apache License 2.0
I am trying to send a REPORT
request to SA with message body and some headers. I am interested in the spam score and upon looking at the detailed analysis report from SA it appears that SA is not parsing the headers which are set on the request.
Here is a sample output --
Spam Report: Spam detection software, running on the system "xxxxxxxx",
has identified this incoming email as possible spam. The original
message has been attached to this so you can view it or label
similar future email. If you have any questions, see
the administrator of that system for details.
Content preview: XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X
Content analysis details: (1005.5 points, 5.0 required)
pts rule name description
---- ---------------------- --------------------------------------------------
1.2 MISSING_HEADERS Missing To: header
-0.0 NO_RELAYS Informational: message was not relayed via SMTP
1000 GTUBE BODY: Generic Test for Unsolicited Bulk Email
-0.0 NO_RECEIVED Informational: message has no Received headers
1.8 MISSING_SUBJECT Missing Subject: header
0.1 MISSING_MID Missing Message-Id: header
1.0 MISSING_FROM Missing From: header
0.0 TVD_SPACE_RATIO No description available.
1.4 MISSING_DATE Missing Date: header
0.0 NO_HEADERS_MESSAGE Message appears to be missing most RFC-822
headers
As you can see, the report says that the To
, Subject
, From
, Date
, and Message-Id
headers are missing despite it being set on the SARequest
object (using request.addHeader()
).
I dug a little further and noticed that if the headers are explicitly included in the message body then SA is able to parse them properly. For example -
SARequest request = new SARequest();
// GTUBE message string
request.setMessage(
"To: to-header" + SARequest.NEW_LINE
+ "From: from-header" + SARequest.NEW_LINE
+ "Message-Id: <"+ UUID.randomUUID()+ "@example.com>" + SARequest.NEW_LINE
+ "XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X");
This is very strange as the SARequest.getRequestByteArray
invoked from SAClient.sendRequest
is essentially doing the same thing.
Also, if there is no new line character in front of the actual message, SA thinks that the message content is empty (despite a NEW_LINE
being added in SARequest.getRequestByteArray
)
Could this be a bug or am I using it incorrectly?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.