Email security

Email and Phishing Detection with Laya

Classify suspicious email and detect credential or payment risk with typed probabilities.

Use case

Use Laya to triage high-volume inbound mail before escalating suspicious messages to a larger detector or human analyst.

State

Your Microsoft 365 password expires today. Confirm your account immediately and enter your password to avoid suspension.

Typed questions

choiceemail_type

How should this email be classified?

normalspamphishing
noulcredential_theft

Is this email trying to obtain account credentials?

Expected direction

  • email_type should favor phishing
  • credential_theft should return a high P(true)
The upstream application benchmark reports strong spam and phishing numbers, but those task families were in the training mix. Validate on your own mail distribution before production automation.

Copy the implementation

Python
from laya import Router
router = Router(preload=True)
state = {"email": "Your Microsoft 365 password expires today. Confirm your account and enter your password."}
questions = {
    "email_type": {"type": "choice", "instructions": "How should this email be classified?", "criteria": {"normal": "legitimate", "spam": "bulk promotion", "phishing": "credential theft"}},
    "credential_theft": {"type": "noul", "instructions": "Is this email trying to obtain account credentials?"}
}
print(router.predict(state, questions))
TypeScript / Node.js
import { Laya } from "@receptron/laya";
const laya = await Laya.load();
const result = await laya.systemOne(
  { email: "Your Microsoft 365 password expires today. Confirm your account." },
  {
    email_type: { type: "choice", instructions: "How should this email be classified?", criteria: { normal: "legitimate", spam: "bulk promotion", phishing: "credential theft" } },
    credential_theft: { type: "noul", instructions: "Is this trying to obtain credentials?" },
  },
);
console.log(result.answers);
await laya.close();