Contact Us

Contact us now

Click here ......

Live Support


The Objective of this tutorial is to move all spam messages to Spam Folder automatically using Procmail Recipe.

Intended Audience

This tutorial is designed for people familiar with Linux/Unix Operating System  and assumes that you have working email server such as Sendmail as well IMAP/POP3 Server.

Procmail to Rescue

Procmail can be used to create mail-servers, mailing lists, sort your incoming mail into separate folders/files (real convenient when subscribing to one or more mailing lists or for prioritising your mail), preprocess your mail, start any programs upon mail arrival (e.g. to generate different chimes on your workstation for different types of mail) or selectively forward certain incoming mail automatically to someone. [Source:].

We will be using Procmail's filtering and sorting functions to automatically move spam messages to Spam Folder.

1) Create a .procmailrc file in the home directory of your user. We will assume it is John

cd /var/www/john
touch .procmailrc

2) Insert the following code into .procmailrc file

* ^X-Spam-Status: Yes              ### Comment: If Spam Status is True
/var/www/john/mail/Spam           ### Comment: Move to Spam Box - Abosloute Path is used, you may use variables

3) Send yourself a Spam message

Using your gmail or another email account send a message to John with the following code in the body (Message)