isbg.learn_mail

isbg.learn_mail(mail, learn_type)

Process a email and try to learn or unlearn it.

Parameters
  • mail (email.message.Message) – email to learn.

  • learn_type (str) – `spam` to learn spam, `ham` to learn nonspam or `forget`.

Returns

It returns a pair of int

The first integer:

A return code of 6 means it was already learned or forgotten, a return code of 5 means it has been learned or forgotten, a -9999 means an error communicating with spamc. If spamc returns an exit code, it returns it.

The second integer:

It’s the original exit code from spamc

Return type

int, int

Notes

See Exit Codes section of the man page of spamc for more information about other exit codes.