Obvious enough really - it's a sane expectation that ones' incoming email is automatically scanned for viruses. This HOWTO explains how to configure Clamav and Apple OS X Mail to tag the subject line of infected emails such that you may choose for yourself what to do with them. This work was developed in concert with other posters at the ClamXav forum and originally published at Macgeekery - one hell of a site I must say!
- Optionally set up clamd (see my HOWTO here). This step is not a pre-requisite, but is very strongly recommended. Without it, Mail will take significantly longer to check for new email, and will be unresponsive to user input whilst doing so.
- Download the Applescript listed above and put it wherever you keep your Applescripts.
- Double-click it to open it up in Script Editor.
- If you have chosen not to install clamd at step 1, search for clamdscan and replace it with clamscan.
- Click the 'Compile' button. If you get no errors, save the script as 'execute-only'.
- Switch to Mail and go into Preferences. In the Rules pane, add a rule that, for all mail, runs an Applescript. Navigate to your newly-saved .scpt file using the 'Choose...' button.
- Drag this rule to the top of the list so that it is processed first and close Preferences.
- Test it. To do this, send yourself an email with the eicar test file attached to it. If that mail has "[**VIRUS** - ClamAV]" preprended to it's subject line then you're all done.