Coder Social home page Coder Social logo

spamc's People

Contributors

dependabot[bot] avatar jmecsei avatar mecseid avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

spamc's Issues

Headers set in request not being parsed by SpamAssassin

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.