Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
maildir & procmail rules
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
javock
Tux's lil' helper
Tux's lil' helper


Joined: 01 Jan 2004
Posts: 106
Location: Babeland... yeah! I wish!

PostPosted: Thu Feb 12, 2004 6:37 pm    Post subject: maildir & procmail rules Reply with quote

Hello there...

I am trying to configure my router/firewall/mail server (moved from redhat a few hours ago)...
The problem comes when I try to use .procmail based rules to deliver mails to different folders.
I use $HOME/.maildir created with maildirmake (check spelling) and the other directories inside that one where made by the IMAP client (thunderbird 0.4). Also I am running postfix and courier-IMAP, both seem to work ok because if I disable .procmailrc (mv .procmailrc .procmailrc~) or mail arrives that has no rule matching it, it gets delivered to the inbox, otherwise (matches rule) it gets lost.
I am sure it's a missconfiguration (can't get the hold of maildir yet, although it seems simple) :oops:

/etc/procmailrc :
Code:


# Use maildir-style mailbox in user's home directory
DEFAULT=$HOME/.maildir/


/etc/postfix :
Code:

queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/lib/postfix
mail_owner = postfix
myorigin = $mydomain
inet_interfaces = $myhostname, localhost
mydestination = $myhostname, localhost.$mydomain
unknown_local_recipient_reject_code = 450
home_mailbox = .maildir/
mailbox_command = /usr/bin/procmail -a $DOMAIN
debug_peer_level = 2
debugger_command =
         PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
         xxgdb $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/sbin/sendmail
newaliases_path = /usr/bin/newaliases
mailq_path = /usr/bin/mailq
setgid_group = postdrop
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix-2.0.16-r1/sample
readme_directory = /usr/share/doc/postfix-2.0.16-r1/readme
default_destination_concurrency_limit = 2
alias_database = hash:/etc/mail/aliases
local_destination_concurrency_limit = 2
alias_maps = hash:/etc/mail/aliases
home_mailbox = .maildir/


looking at it without the comments makes me feel that there are too much options :?

$HOME/.procmailrc
Code:

PATH=/usr/bin:/usr/local/bin:/bin
MAILDIR=$HOME/.maildir/
LOGFILE=/tmp/log.procmail.$LOGNAME
LOG="--- Logging for $LOGNAME."
SHELL=/bin/bash
SENDER=`formail -x Return-Path | sed 's/[<>]//g;s/^[ ]*//'`
SUBJECT=`formail -x Subject: | expand | sed -e 's/^[ ]*//g' -e 's/[ ]*$//g'`
VERBOSE=yes
LOGABSTRACT=all

:0
* ^To:.*javock@perso.com.ar
.contactos


Hope you people can figure it out!

Thanks


Edit : Forgot the LOG


Code:
--- Logging for personaje.--- Logging for personaje.procmail: [11743] Thu Feb 12 12:33:50 2004
procmail: Assigning "LOGABSTRACT=all"
procmail: No match on "^Received:.*javier@urien.com.ar"
procmail: No match on "^From:.*root@homero.urien.com.ar"
procmail: Match on "^To:.*javock@perso.com.ar"
procmail: Assigning "LASTFOLDER=.contactos/msg.s9B"
procmail: Opening ".contactos/msg.s9B"
procmail: Acquiring kernel-lock
procmail: [11749] Thu Feb 12 12:33:50 2004
procmail: Assigning "LOGABSTRACT=all"
procmail: Notified comsat: "personaje@0:/home/personaje/.maildir//.contactos/msg.s9B"
From perso@abraham.com  Thu Feb 12 12:33:50 2004
 Subject: mas test para procmail....
  Folder: .contactos/msg.s9B                                               1456

_________________
The heart has reasons that the reason will never understand.

-- La Renga. El final es donde partí
Back to top
View user's profile Send private message
eNut
n00b
n00b


Joined: 13 Jun 2003
Posts: 36

PostPosted: Thu Feb 12, 2004 7:26 pm    Post subject: Reply with quote

Do you have a cur, tmp, and new dir in the .contactos/ directory?
Back to top
View user's profile Send private message
javock
Tux's lil' helper
Tux's lil' helper


Joined: 01 Jan 2004
Posts: 106
Location: Babeland... yeah! I wish!

PostPosted: Thu Feb 12, 2004 7:40 pm    Post subject: Reply with quote

eNut wrote:
Do you have a cur, tmp, and new dir in the .contactos/ directory?


this is what I got :
Code:
personaje@abraham .contactos $ pwd
/home/personaje/.maildir/.contactos
personaje@abraham .contactos $ ll -la
total 47
drwx------    6 personaje users         392 Feb 12 12:33 .
drwx------   68 personaje users        2200 Feb 12 13:45 ..
drwx------    2 personaje users          48 Feb  9 05:31 courierimapkeywords
-rw-r--r--    1 personaje users        1575 Feb  9 06:43 courierimapuiddb
drwx------    2 personaje users        1984 Feb  9 06:43 cur
-rwx------    1 personaje users           0 Feb  9 05:26 maildirfolder
-rw-------    1 personaje users        1432 Feb 12 12:04 msg.49B
-rw-------    1 personaje users        1456 Feb 12 12:12 msg.68B
-rw-------    1 personaje users        1456 Feb 12 12:23 msg.97B
-rw-------    1 personaje users        1456 Feb 12 12:16 msg.C-B
-rw-------    1 personaje users        1456 Feb 12 12:19 msg.D-B
-rw-------    1 personaje users        1456 Feb 12 12:33 msg.s9B
-rw-------    1 personaje users       12176 Feb 12 12:04 msg.y9B
drwx------    2 personaje users          48 Feb  9 05:26 new
drwx------    2 personaje users          48 Feb 12 13:30 tmp


Now that I see, there are files (msg.*) that seem to be the mails... should I change the rule to this? :

Code:
:0
* ^To:.*javock@perso.com.ar
.contactos/new


I will try and let you now...
_________________
The heart has reasons that the reason will never understand.

-- La Renga. El final es donde partí
Back to top
View user's profile Send private message
Souperman
Guru
Guru


Joined: 14 Jul 2003
Posts: 449
Location: Cape Town, South Africa

PostPosted: Thu Feb 12, 2004 8:03 pm    Post subject: Reply with quote

AFAIK, the dir to move to in your .procmailrc needs to end in a trailing / when using maildir mailboxes.

HTH
_________________
moo
Back to top
View user's profile Send private message
javock
Tux's lil' helper
Tux's lil' helper


Joined: 01 Jan 2004
Posts: 106
Location: Babeland... yeah! I wish!

PostPosted: Thu Feb 12, 2004 8:18 pm    Post subject: Reply with quote

Tryed this rules :

Code:
# procmail configuration.

# Vars
PATH=/usr/bin:/usr/local/bin:/bin
MAILDIR=$HOME/.maildir/
#LOGFILE=/var/log/log.procmail.$LOGNAME
#LOGFILE=/var/log/messages
LOGFILE=/tmp/log.procmail.$LOGNAME
LOG="--- Logging for $LOGNAME."
SHELL=/bin/bash
SENDER=`formail -x Return-Path | sed 's/[<>]//g;s/^[ ]*//'`
SUBJECT=`formail -x Subject: | expand | sed -e 's/^[ ]*//g' -e 's/[ ]*$//g'`
VERBOSE=yes
LOGABSTRACT=all
LASTFOLDER=$(pwd)
#DEFAULT=$HOME/.maildir/

# End Config Vars

:0
* ^To:.*javock@perso.com.ar
$MAILDIRcontactos/new

:0
* ^Received:.*javock@perso.com.ar
$MAILDIRcontactos/new


And got this...


Code:
--- Logging for personaje.procmail: [5256] Thu Feb 12 14:26:21 2004
procmail: Assigning "LOGABSTRACT=all"
procmail: Assigning "LASTFOLDER=$(pwd)"
procmail: Match on "^To:.*javock@perso.com.ar"
procmail: Assigning "LASTFOLDER=/new"
procmail: Opening "/new"
procmail: Error while writing to "/new"
procmail: Match on "^Received:.*javock@perso.com.ar"
procmail: Assigning "LASTFOLDER=/new"
procmail: Opening "/new"
procmail: Error while writing to "/new"
procmail: Assigning "LASTFOLDER=/home/personaje/.maildir/new/1076606781.5256_0.a
braham"
procmail: Notified comsat: "personaje@0:/home/personaje/.maildir/new/1076606781.
5256_0.abraham"
From perso@abraham.com  Thu Feb 12 14:26:21 2004
 Subject: testeando, porque la otra vez me =?ISO-8859-1?Q?equivoqu=E9!?=
  Folder: /home/personaje/.maildir/new/1076606781.5256_0.abraham           1437


I think I should try using the dot... I will let you know!
_________________
The heart has reasons that the reason will never understand.

-- La Renga. El final es donde partí
Back to top
View user's profile Send private message
javock
Tux's lil' helper
Tux's lil' helper


Joined: 01 Jan 2004
Posts: 106
Location: Babeland... yeah! I wish!

PostPosted: Thu Feb 12, 2004 8:22 pm    Post subject: Reply with quote

javock wrote:
Tryed this rules :

Code:
# procmail configuration.

..Snipety Snipety..

:0
* ^To:.*javock@perso.com.ar
$MAILDIRcontactos/new

:0
* ^Received:.*javock@perso.com.ar
$MAILDIRcontactos/new


is there a way to turn this two rules into one? I mean like an OR-something? like this :

Code:
 IF * ^To:.*javock@perso.com.ar OR * ^Received:.*javock@perso.com.ar THEN
move/to/somewhere


Thanks
_________________
The heart has reasons that the reason will never understand.

-- La Renga. El final es donde partí
Back to top
View user's profile Send private message
javock
Tux's lil' helper
Tux's lil' helper


Joined: 01 Jan 2004
Posts: 106
Location: Babeland... yeah! I wish!

PostPosted: Thu Feb 12, 2004 8:26 pm    Post subject: maildir & procmail rules [WORKING] Reply with quote

That did it...

Had it working with this :

Code:
# procmail configuration.

# Vars
PATH=/usr/bin:/usr/local/bin:/bin
MAILDIR=$HOME/.maildir/
#LOGFILE=/var/log/log.procmail.$LOGNAME
#LOGFILE=/var/log/messages
LOGFILE=/tmp/log.procmail.$LOGNAME
LOG="--- Logging for $LOGNAME."
SHELL=/bin/bash
SENDER=`formail -x Return-Path | sed 's/[<>]//g;s/^[ ]*//'`
SUBJECT=`formail -x Subject: | expand | sed -e 's/^[ ]*//g' -e 's/[ ]*$//g'`
VERBOSE=yes
LOGABSTRACT=all
LASTFOLDER=$(pwd)
#DEFAULT=$HOME/.maildir/

# End Config Vars

:0
* ^To:.*javock@perso.com.ar
$MAILDIR.contactos/new

:0
* ^Received:.*javock@perso.com.ar
$MAILDIR.contactos/new


Now if I just could get that OR-thing working!! :evil:

Thanks!!
_________________
The heart has reasons that the reason will never understand.

-- La Renga. El final es donde partí
Back to top
View user's profile Send private message
Souperman
Guru
Guru


Joined: 14 Jul 2003
Posts: 449
Location: Cape Town, South Africa

PostPosted: Fri Feb 13, 2004 6:59 am    Post subject: Reply with quote

[quote="javock"]
javock wrote:
is there a way to turn this two rules into one? I mean like an OR-something? like this :

Code:
 IF * ^To:.*javock@perso.com.ar OR * ^Received:.*javock@perso.com.ar THEN
move/to/somewhere


Thanks

Code:
* ^(Received|To):.*javock@perso.com.ar


(aaa|bbb|ccc) in regexp "match 'aaa' or 'bbb' or 'ccc'".

HTH
_________________
moo
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum