Spam Logic
​This solution leverages email header inspection to determine whether a message should be classified as spam. By analyzing both Microsoft’s Spam Confidence Level (SCL) and the X-Spam-Flag header (used by spam filtering software like SpamAssasian), the apex action provides a reliable indicators to determine the legitimacy of incoming emails.
Components
- Spam Logic apex Action
Price
One-time $199
Sandbox: Use the installation link to install and test the functionality.
Production: Contact us for production trial keys or to purchase.
The Get Spam from Email Headers apex action
Spam Logic provides an apex action that can be leveraged in flow, apex, and batches. Simpy pass in the Email Message header as an input, and the apex will populate the spam indicators as output.
Inputs
Email Header
The email header string
Outputs
Spam Confidence Level
see below
Spam Confidence Level Definition
see below
Spam Confidence Level Category
see below
Bulk Compliance Level
see below
Bulk Compliance Level Definition
see below
Spam Flag
see below
Spam Score
see below
isSuccess
Set to True if the apex action was successful. Set to False if an error was encountered.
Error Message
If status is “Fail”, the message of the error encountered
Sample apex script
List <getSpamFromHeader_IM.parameter> params = new List <getSpamFromHeader_IM.parameter>();
getSpamFromHeader_IM.parameter param = new getSpamFromHeader_IM.parameter();
param.emailHeader = 'X-Microsoft-Antispam: BCL:9\n';
params.add(param);
List <getSpamFromHeader_IM.returnData> rd = getSpamFromHeader_IM.getSpam(params);
system.debug(rd[0].bulkComplaintLevel);
Sample flow execution


What is Junk email?
Junk email is spam. Yes, this is an extremely basic definition. But for our needs, spam/junk email is typically defined as unsolicited and universally unwanted email message.
What is Bulk email?
​Bulk email (or gray mail) is email generated in bulk. In other words, a mailer generates the same or similar content to a large number of recipients. Unlike spam email, bulk email may be good or bad (and many shades in between). Bulk email might be "good", such as a vendor sending coupon codes to individuals that have subscribed to a service. Bulk email might be "bad", such as a vendor selling a high volume of unsolicited content.
What is Microsoft 365 Exchange Online Protection?
In Microsoft 365 organizations with mailboxes in Exchange Online or standalone Exchange Online Protection (EOP) organizations without Exchange Online mailboxes, inbound messages go through spam filtering in EOP and are assigned a spam score(s). The specific EOP scores we will be discussing today are Spam Confidence Level (SCL) and Bulk Complaint Level (BCL)
What is Bulk Complaint Level (BCL)?
The EOP filtering process assigns email a BCL score. The higher the score, the more likely the email has or will generated complaints. The higher the likelihood of complaints, the more likely the email is spam.
0
The message isn't from a bulk sender.
1, 2, 3
The message is from a bulk sender that generates few complaints.
4, 5, 6, 7
The message is from a bulk sender that generates a mixed number of complaints.
8, 9
The message is from a bulk sender that generates a high number of complaints.
What is Spam Confidence Level (SCL)?
The EOP filtering process assigns emails a SCL score. The higher the score, the more likely an email is spam. The scores break down as follows:
Spam Confidence Level
Definition
-1
The message skipped spam filtering. The email is from a safe sender.
0, 1
Spam filtering determined the message wasn't spam.
5, 6
Spam filtering marked the message as Spam
7, 8, 9
Spam filtering marked the message as High confidence spam
What is X-Spam?
X-Spam headers are metadata fields inserted into email headers by spam-filtering systems, commonly generated by open-source tools such as SpamAssassin. The Get Spam From Headers apex action will return the following values if present.
Spam Flag
A simple indicator usually set to YES (email is spam) or NO (email is not spam) based on the email server's spam rules.
Spam Score
A numeric value representing how spammy a an email message appears. This is generated based on the number of tests the email passes or fails. Generally, a spam score of 5.0 or above is considered spam.
