Scanning Message Details

The PMX_EV_SPAMPROB event contains the email message's spam probability. The probability is calculated according to the score assigned to the rules matched by the email message.

static void
scan_cb(void *host, PMX_EVENT e, PMX_TYPE t1,
    const void *v1, size_t l1, PMX_TYPE t2,
    const void *v2, size_t l2)
    switch (e) {
        if (t1 == PMX_TYPE_STRING)
            printf("Found feature: %s\n", v1);
        if (t1 == PMX_TYPE_DOUBLE)
            printf("Spam probability for this message: %5.3f%%\n",*(double*)v1);


  • The scan_cb callback function is passed several parameters. These include the event that triggered the callback and the values with their associated types.
  • If the callback function is triggered by a feature found in an email message, the event type is PMX_EV_FOUND_FEATURE and the first value is the name of the found feature.
  • If the callback function is invoked because scanning is complete and the engine has a spam probability to report, the event type is PMX_EV_SPAMPROB.
  • The spam probability for the scanned email message is the value passed.