API for creating new spam filter?
Question asked by josh levine - 8/27/2019 at 10:29 AM
Is there any documentation for creating a new "spam check" for SmarterMail 16.x+?

I want to create something like "Declude" or "Message Sniffer". I can not use the spool proc folder because I want to be able to see (and possibly reject) the message before the SMTP server returns a 2XX.


4 Replies

Reply to Thread
Employee Replied
Employee Post Marked As Answer
josh levine Replied

This looks like the API for controlling some of the existing spam checks - I am looking for a way to create a new spam check. 

Hopefully it would be some kind of a spec where you can tell SmarterMail to call an external program or procedure with an email that was just received over SMTP, and you would return a value indicating if SmarterMail should issue a 2XX response and add the new email to the spool, or to reject it. 

There must be something like this already in SmarterMail that is used to call Declude and others, I just can't find the documentation for it. 


Tony Scholz Replied
Employee Post

The API call used for creating custom rules is 
  • http://{domain.tld}/Documentation/api#/reference/SmarterMail.Web.Controllers.Api.AntiSpamVirusController/UpdateCustomRules
From here you can adjust as needed. Here is an example API call. 
  • Request URL: http://{domain.tld}/api/v1/settings/sysadmin/antispam/custom-rules/update
  • Request Method: POST
  • Status Code: 200 OK
  • Body:{{"ItemsToUpdate":[{"name":"SPAM_CHECK_RULE_NAME_2","source":"Header","ruleArgument":"HEADER_RULE_FIELD","matchType":"Contains","weight":0,"matchMultiple":false,"ruleItems":["RULE_TEXT","ONE_PRE_LINE"],"enableFiltering":true,"enableOutgoingSmtpBlocking":true,"new":true}]}
You will need to adjust for what you are wanting to do. 
Thank you
Tony Scholz
System/Network Administrator
SmarterTools Inc.
(877) 357-6278
josh levine Replied

I am looking to do more than simple, static, rule-based checks. I'd like to run code against the incoming message to evaluate it, and then return a result back to the SmarterMail SMTP server as to whether to accept or reject the message. 

It is similar to how the "spool proc" folder works, except that by the time a message makes it to the spool proc folder it has already been accepted and I want to be able to flag the message to be rejected. 



Reply to Thread