Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 08-10-2009, 01:58 AM   #1
Registered: Jun 2008
Posts: 113

Rep: Reputation: 15
Sendmail : Procmail : Aliases : .Forward


I am stuck with a difficult situation.

I have Sendmail, Procmail, Aliases, .Forward file on a hosted VPS.

I need incoming files to be first filtered for SPAM and then distributed to internal users using .forward or aliases.

The problem is, aliases and .forward rules get executed first leading to all users getting spam.

I have done a lot of googling and tried many options but it just does not seem to work.

I am sure this is a common problem which must have been solved by many administrators.

Please suggest the best solution.

Old 08-10-2009, 07:06 AM   #2
LQ Newbie
Registered: Jan 2008
Posts: 23

Rep: Reputation: 15
You sholud work on procmail. It gets all mail messages and then you can send to the spam filter (depending on which one you installed, you should find a sample .procmailrc file).

I suggest you first try it in your home ~/.procmailrc and then /etc/procmailrc if all is working correctly.
Old 08-10-2009, 07:50 AM   #3
Registered: Jun 2008
Posts: 113

Original Poster
Rep: Reputation: 15
I have tried procmailrc, but it still does not solve my problem.

Let me give you an example:

My aliases file has this:
sales: sales, ## Emails sent to sales@mydomain should be delivered to sales@mydomain &
This is working fine.

My /etc/procmailrc has a filter as follows:
Now, if I get any email to with subject containing "viagra", the email is sent to junk, but I also get a copy of the email in & sales@mydomain

It seems like the procmailrc & aliases both are working on the email.

What I would like is the mail to be deliered to junk only and aliases should not be processed.

I have tried using /home/sales/.forward for forwarding emails to but even then, I just emails in junk & sales@mydomain &

Pls help.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sendmail Aliases: forward mail to script mikeshn Linux - Software 2 07-03-2010 09:22 PM
sendmail and NIS databases (aliases, mail.aliases) - what kind of databases? cotton213 Linux - Software 0 03-14-2006 06:57 PM
Using procmail to forward a copy of mails J_Szucs Linux - Software 2 02-09-2006 03:31 PM
Problem with .forward and procmail Dick_Kennedy Linux - Software 0 02-03-2006 05:45 PM
sendmail: not possible to pipe mail to programs using ~/.forward && /etc/mail/aliases fhd Linux - Networking 1 01-09-2005 07:05 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:14 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration