4. HTTP API
The message to classify should be sent in as a JSON object with a message property.
curl -X 'POST' \
'http://127.0.0.1:8000/v1/bnac/batch' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{"message": "451 4.7.1 <[email protected]>: Recipient address rejected: Greylisting in effect, please come back later"}'
This request passes in a message and receives a result:
{"class":"GRAYLISTING"}
4.1. Results
An object with a class property is returned, the classifications can be:
Classification |
Suggested Action |
Severity |
Scope |
---|---|---|---|
|
Recipient MTA is blocking, with third-party (e.g. Spamhaus,..) information |
5 |
|
|
Recipient MTA is blocking, no third-party information |
3 |
|
|
Fix DKIM |
3 |
|
|
Fix DMARC |
3 |
|
|
Fix reverse DNS |
3 |
|
|
Slow down from this sending domain |
4 |
|
|
Slow down to this recipient domain, you are at risk of being blocked |
3 |
|
|
Slow down from this sending IP |
4 |
|
|
Suspend campaign and review what is sent |
3 |
|
|
Verify your DNS resolution of this recipient domain |
3 |
|
|
Slow down to this recipient domain |
3 |
|
|
Slow down, possible poor list quality, reduce frequency to this address |
2 |
|
|
Remove the address |
1 |
recipient address |
|
Fix SPF |
3 |
|
|
Slow down sending to this recipient domain |
1 |
|
|
Check your TLS negotiation with this recipient domain |
3 |
|
|
Suspend campaign and review what is sent |
6 |
|
4.1.1. Severity
6 = Most severe impact on sender reputation
1 = Lowest impact on sender reputation
4.2. Example HSL script
This example script can be run from the terminal directly with hsh.
It is equivalent to the curl
example above, passing in a message and receiving a response.
$guru = "http://127.0.0.1:8000/v1/bnac/batch"; $options = ["headers" => ["Content-Type: application/json", "Accept: application/json"], "extended_result" => true]; $data = "451 4.7.1 <[email protected]>: Recipient address rejected: Greylisting in effect, please come back later"; $payload = json_encode(["message" => $data]); $res = http($guru, $options, [], $payload); if ($res["content"]) { $content = json_decode($res["content"]); $class = $content["class"]; echo $class; }
For best performance in calls from script hooks, use the http-background plugin instead of the foreground http function.