Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Configuring procmail to deliver mail to cyrus-imap {Solved}
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
feliperal
Apprentice
Apprentice


Joined: 09 Mar 2003
Posts: 168

PostPosted: Sun Apr 02, 2006 10:40 am    Post subject: Configuring procmail to deliver mail to cyrus-imap {Solved} Reply with quote

I am having a hard time trying to get procmail to deliver all mail to my imap server cyrus-imap. I am using procmail currently as a local delivery agen and am able to deliver emails to the several unix accounts I have on the box. However, I cannot deliver mail to the cyrus-imap server so I can access my email using Thunderbird or webmail when I'm not home. I am not using a virtual setup.

Here is my configs so far:

main.cf:
[code]
# LOCAL PATHNAME INFORMATION
queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/lib/postfix
mail_owner = postfix

# INTERNET HOST AND DOMAIN NAMES
myhostname = xxxxx
mydomain = xxxxx.com

# SENDING MAIL
myorigin = $mydomain

# RECEIVING MAIL
inet_interfaces = all
mydestination= $mydomain $myhostname, localhost

# REJECTING MAIL FOR UNKNOWN LOCAL USERS
unknown_local_recipient_reject_code = 550
mynetworks_style = host


# ALIAS DATABASE
alias_maps = hash:/etc/mail/aliases
alias_database = hash:/etc/mail/aliases

# DELIVERY TO MAILBOX
mailbox_transport = procmail
mailbox_command = /usr/bin/procmail

# PARALLEL DELIVERY TO THE SAME DESTINATION
local_destination_concurrency_limit = 2
default_destination_concurrency_limit = 10

# DEBUGGING CONTROL
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

# INSTALL-TIME CONFIGURATION INFORMATION
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 = /etc/postfix
readme_directory = /usr/share/doc/postfix-2.2.9/readme
home_mailbox = .maildir/

[/config]

master.cf
[code]
#
# Postfix master process configuration file. For details on the format
# of the file, see the Postfix master(5) manual page.
#
# ==========================================================================
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (yes) (never) (100)
# ==========================================================================
smtp inet n - n - - smtpd -v
#submission inet n - n - - smtpd
# -o smtpd_etrn_restrictions=reject
# -o smtpd_client_restrictions=permit_sasl_authenticated,reject
#smtps inet n - n - - smtpd
# -o smtpd_tls_wrappermode=yes -o smtpd_sasl_auth_enable=yes
#submission inet n - n - - smtpd
# -o smtpd_etrn_restrictions=reject
# -o smtpd_enforce_tls=yes -o smtpd_sasl_auth_enable=yes
#628 inet n - n - - qmqpd
pickup fifo n - n 60 1 pickup
cleanup unix n - n - 0 cleanup
qmgr fifo n - n 300 1 qmgr
#qmgr fifo n - n 300 1 oqmgr
tlsmgr unix - - n 1000? 1 tlsmgr
rewrite unix - - n - - trivial-rewrite
bounce unix - - n - 0 bounce
defer unix - - n - 0 bounce
trace unix - - n - 0 bounce
verify unix - - n - 1 verify
flush unix n - n 1000? 0 flush
proxymap unix - - n - - proxymap
smtp unix - - n - - smtp
# When relaying mail as backup MX, disable fallback_relay to avoid MX loops
relay unix - - n - - smtp
-o fallback_relay=
# -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq unix n - n - - showq
error unix - - n - - error
discard unix - - n - - discard
local unix - n n - - local
virtual unix - n n - - virtual
lmtp unix - - n - - lmtp
anvil unix - - n - 1 anvil
scache unix - - n - 1 scache
#
# ====================================================================
# Interfaces to non-Postfix software. Be sure to examine the manual
# pages of the non-Postfix software to find out what options it wants.
#
# Many of the following services use the Postfix pipe(8) delivery
# agent. See the pipe(8) man page for information about ${recipient}
# and other message envelope options.
# ====================================================================
#
# maildrop. See the Postfix MAILDROP_README file for details.
# Also specify in main.cf: maildrop_destination_recipient_limit=1
#
maildrop unix - n n - - pipe
flags=DRhu user=vmail argv=/usr/local/bin/maildrop -d ${recipient}
#
# The Cyrus deliver program has changed incompatibly, multiple times.
#
#old-cyrus unix - n n - - pipe
# flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user}
# Cyrus 2.1.5 (Amos Gouaux)
# Also specify in main.cf: cyrus_destination_recipient_limit=1
cyrus unix - n n - - pipe
user=cyrus argv=/usr/lib64/cyrus/deliver -e -r ${sender} -m ${extension} ${user}

procmail unix - n n - - pipe
flags=R user=cyrus argv=/usr/bin/procmail -t -m USER=${user} EXTENSION=${extension} /etc/procmailrc
[/code]

/etc/procmailrc:
[code] GNU nano 1.3.11 File: /etc/procmailrc

###
#
# Master Procmail Recipe for Postfix > Procmail > Cyrus
#
###
SHELL=/bin/bash
LOGFILE=/var/log/procmail.log # for testing & troubleshooting
VERBOSE=yes

# Use maildir-style mailbox in user's home directory
DEFAULT=$HOME/.maildir/
USER=`echo $USER | /usr/bin/tr A-Z a-z` # force lowercase username
DELIVERTO="/usr/lib64/cyrus/deliver"
USERINBOX="$DELIVERTO -e -a $USER -m user/$USER"

# if not told otherwise, deliver all messages to the user's inbox
:0w
| $USERINBOX

#
# OPTIONAL: Include users' own .procmail recipe files
#
INCLUDERC=/home/$USER/.procmailrc


[/code]

My error logs:
[code]
Apr 2 03:28:41 [postfix/pickup] 56514A9B2C: uid=1002 from=<felipe>
Apr 2 03:28:41 [postfix/cleanup] 56514A9B2C: message-id=<20060402102841.GA3209@xxxx.com>
Apr 2 03:28:41 [postfix/qmgr] 56514A9B2C: from=<felipe@xxxx.com>, size=414, nrcpt=1 (queue active)
Apr 2 03:28:41 [procmail] Error while writing to "/usr/cyrus/.getmail/.procmail.log"
Apr 2 03:28:41 [postfix/pipe] 56514A9B2C: to=<felipe@xxxx.com>, orig_to=<felipe>, relay=procmail, delay=0, status=sent (xxxx)
[/code]


Last edited by feliperal on Wed Apr 05, 2006 2:27 pm; edited 1 time in total
Back to top
View user's profile Send private message
feliperal
Apprentice
Apprentice


Joined: 09 Mar 2003
Posts: 168

PostPosted: Wed Apr 05, 2006 2:26 pm    Post subject: Reply with quote

I solved it.... I changed a few things in my /etc/procmailrc:
Code:

#####################################################################
#
# Master Procmail Recipe for Postfix > Procmail > Cyrus
####################################################################
###
SHELL=/bin/sh
LOGFILE=/var/log/procmail/procmail.log
VERBOSE=yes

# Use maildir-style mailbox in user's home directory
DEFAULT=$HOME/.maildir/
USER=`echo $USER | /usr/bin/tr A-Z a-z` # force lowercase username
DELIVERTO="/usr/lib64/cyrus/deliver"
USERINBOX="$DELIVERTO -e -a $USER -m user.$USER"
# if not told otherwise, deliver all messages to the user's inbox
:0w
| $USERINBOX

# OPTIONAL: Include users' own .procmail recipe files
INCLUDERC=/home/$USER/.procmailrc


the problem was with the USERINBOX variable above... it was trying to send the mail to mailbox (designated by deliver -m switch) user/$USER which no cyrus mailbox existed. Changing it to a deliver -e -a $USER -m user.$USER fixed it.

If anyone is interested, I will be making a howto on how to get postfix + cyrus-imap + procmail + dspam + clamav working for the local user setup. I feel that most people like me, don't want to spend the time needed to setup up a virtual setup, when a local setup would do just fine. If anyone is interested, I will be happy to put detailed notes on how I get these components working.


Felipe
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