LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 05-13-2010, 06:18 PM   #1
chris75898
LQ Newbie
 
Registered: May 2010
Posts: 1

Rep: Reputation: 0
How do you use procmail to put email in specific user's folders?


Here is what I want to do: have procmail get my mail from all of the different mail servers, and then put them in my inbox folder (I'm able to do all of this), but also have my emails sorted by domain into subfolders.

So for example, procmail downloads my email, puts it into the gmail folder which is a subfolder of my inbox folder.

I know how to get all of my email into the inbox folder - but not into a specific subfolder.

Please Help!
 
Old 05-14-2010, 02:54 AM   #2
centosboy
Senior Member
 
Registered: May 2009
Location: london
Distribution: centos5
Posts: 1,137

Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by chris75898 View Post
Here is what I want to do: have procmail get my mail from all of the different mail servers, and then put them in my inbox folder (I'm able to do all of this), but also have my emails sorted by domain into subfolders.

So for example, procmail downloads my email, puts it into the gmail folder which is a subfolder of my inbox folder.

I know how to get all of my email into the inbox folder - but not into a specific subfolder.

Please Help!
Code:
# Please check if all the paths in PATH are reachable, remove the ones that
# are not.

PATH=$HOME/bin:/usr/bin:/usr/ucb:/bin:/usr/local/bin:.
MAILDIR=$HOME/Mail      # You'd better make sure it exists
DEFAULT=$MAILDIR/mbox
LOGFILE=$MAILDIR/from
LOCKFILE=$HOME/.lockmail

:0                              # Anything from thf
* ^From.*thf@somewhere.someplace
todd                            # will go to $MAILDIR/todd

:0                              # Anything from people at uunet
* ^From.*@uunet
uunetbox                        # will go to $MAILDIR/uunetbox

:0                              # Anything from Henry
* ^From.*henry
henries                         # will go to $MAILDIR/henries

# Anything that has not been delivered by now will go to $DEFAULT
# using LOCKFILE=$DEFAULT$LOCKEXT

/usr/share/doc/procmail-3.22/examples/1procmailrc
Code:
# Please check if all the paths in PATH are reachable, remove the ones that
# are not.

PATH=$HOME/bin:/usr/bin:/usr/ucb:/bin:/usr/local/bin:.
MAILDIR=$HOME/Mail      # You'd better make sure it exists
DEFAULT=$MAILDIR/mbox
LOGFILE=$MAILDIR/from
LOCKFILE=$HOME/.lockmail

:0                              # Anything from thf
* ^From.*thf@somewhere.someplace
todd                            # will go to $MAILDIR/todd

:0                              # Anything from people at uunet
* ^From.*@uunet
uunetbox                        # will go to $MAILDIR/uunetbox

:0                              # Anything from Henry
* ^From.*henry
henries                         # will go to $MAILDIR/henries

# Anything that has not been delivered by now will go to $DEFAULT
# using LOCKFILE=$DEFAULT$LOCKEXT
cat /usr/share/doc/procmail-3.22/examples/3procmailrc
Code:
# Please check if all the paths in PATH are reachable, remove the ones that
# are not.

PATH=$HOME/bin:/usr/bin:/global/bin:/usr/ucb:/bin:/usr/local/bin:
MAILDIR =       $HOME/Mail      # You'd better make sure it exists
DEFAULT =       $MAILDIR/mbox
LOGFILE =       $MAILDIR/from
LOCKFILE=       $HOME/.lockmail

                        # This will create a local lockfile named todd.lock
:0:                     # *if* the condition matches
* ^From.*thf
todd

LOCKFILE=$MAILDIR/whatever      # This will remove the global lockfile
                                # $HOME/.lockmail and the new lockfile
                                # will be $MAILDIR/whatever


                                # The next recipe will
                                # filter out all messages from "at"
                                # jobs and will put them in a terse format
                                # (only the date and the body) in
                                # a file called $MAILDIR/atjunk
:0 fh
* ^From root
* ^Subject: Output from "at" job
|egrep "^Date:"
                                # The next recipe will only be used if
                                # the previous one matched
:0 A
atjunk



MAILDIR=$HOME/News      # This will change the current directory


                        # The next recipe will create a local lockfile
                        # named $HOME/News/dustbin.lock (*if* the condition
                        # matches), and will feed the body of the message
                        # through `sort` (sorry, couldn't come up with anything
                        # better :-), after which the result will be
                        # appended to $HOME/News/dustbin
:0 b:
* ^Subject:.*rubbish
|sort >>dustbin

                        # The next recipe will use the games directory as a MH
                        # folder (of course you need MH to read the mail then)
:0
* ^Subject:.*games
games/.

# Anything not delivered by now will go to $HOME/Mail/mbox
# Using LOCKFILE=$HOME/Mail/mbox.lock
hope this helps you....taken from the procmail examples.
I have used these before as a guide and they are very easy to implement.

Last edited by centosboy; 05-14-2010 at 02:56 AM.
 
  


Reply



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
How to deny root access to specific user's files haariseshu Red Hat 8 09-04-2009 07:36 AM
How to build a link and put them to user's desktop? KFC123 Linux - Desktop 1 06-20-2009 03:45 PM
put mail in specific imap folder (procmail with Gmail) drj000 Linux - Software 0 03-06-2009 02:50 PM
delete .exe files in user's home folders Winanjaya Linux - Newbie 5 11-06-2008 08:52 PM
automount specific user's file on an NFS server cememet Linux - Networking 4 05-16-2007 08:45 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 09:16 AM.

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