Train SpamAssassin SPAM with .eml file

SpamAssassin has a neat tool called sa-learn which allows you train SpamAssassin with various files as to what it identifies as SPAM and HAM (not SPAM).

Assume you have an email which you received that you’d like to feed as SPAM. Simply download the email and ensure it is saved in the with the .eml extension. Next, copy spam-email.eml to your mail server running SpamAssassin. Finally, run the following command to feed this file as SPAM:

sa-learn --spam spam-email.eml

Assuming you wanted to train SpamAssassin that a particular email is HAM, run the following command:

sa-learn --ham ham-email.eml

This can also be done on cPanel. The only difference is of course the path of sa-learn binary which is located as follows: