#!/bin/sh # Author Rick Updegrove # 2003, Aug 06 # Updated 2008, January 18 # This is a wrapper that I used to make Cyrus deliver to a Maildir # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # INSTALL # This assumes you already have qmail installed following LWQ (Life With Qmail) # http://www.lifewithqmail.org/ and Cyrus IMAP server http://cyrusimap.web.cmu.edu/ # and both are working. # 1.) Rename the file to qmail2cyrus.sh and install it # to /usr/local/bin/qmail2cyrus.sh # 2.) Read the orignal thread at http://rick.updegrove.net/qmail2cyrus/ # TODO: In order to use vpopmail and SpamAssassin to deliver to your IMAP INBOX # Vpopmail strips environment variables so you have to use something like # /usr/local/vpopmail/bin/vdelivermail "$DEFAULT"@"$HOST" # Or you could just change your .qmail-default to (keep it all on one line). # | /var/qmail/bin/preline /usr/local/bin/spamc -u "$DEFAULT"@"$HOST" | # /usr/local/vpopmail/bin/vdelivermail '' bounce-no-mailbox # First get the userid which is before the first dash. userid="`echo "${LOCAL%%-*}" | tr "A-Z" "a-z"`" # Then change dashes to dots mailbox="`echo "$EXT2" | tr "A-Z" "a-z" | sed "s/-/./g"`" if [ "$mailbox" = "" ] then # Use Cyrus to deliver to your IMAP INBOX /usr/local/cyrus/bin/deliver "$userid" else # Use Cyrus to deliver to a folder (whatever Cyrus uses). /usr/local/cyrus/bin/deliver -m "$mailbox" -a "$userid" "$userid" fi # qmail is expecting exit codes so we have to deal with that. case $? in 64|65|66|67|68|76|77|78) exit 100 ;; 0) exit 0 ;; *) exit 111 ;; esac