[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: IMAP + fetchmail + procmail



Hi,

I run an IMAP setup similar to what you describe at home here, and I've
also deployed servers for companies with IMAP systems set up there too.

On Mon, Jun 03, 2002 at 09:38:37PM -0400, Jason Bleazard wrote:
> I've found a lot of good documentation about IMAP, fetchmail and
> procmail individually.  However, I'm trying to figure out how to make
> them all work together and I'm afraid I don't quite get it.  I've tried
> some Google searches and found myself overwhelmed with information that
> didn't really apply to my situation.  If anyone could point me toward
> some good documents or offer a few pointers, I'd sure appreciate it. 
> I'm just looking to download from three POP3 accounts and serve e-mail
> to two users (myself and my wife), so I don't need a large capacity
> setup.

Yes, there is a *lot* of info.
Basically, the first choice is: do you need group access to mail
folders? If you do then you must use Cyrus IMAP, otherwise I would
suggest you use UW-imapd. Yes, I know people will say that you can do
group access to uw-imapd, but I never got it to work, and cyrus is
easier and more suited to that task. However, cyrus is a lot easier to
reconfigure, and is more flexible. If you don't want to actually have to
edit the code of uw-imapd in order to get it to work with your setup as
I did, then use Cyrus.

> We have a (modest :-) home network of four machines scattered around the
> house, running a mix of Debian and Windows.  I'm building a fifth to act
> as a central file server, and I'd like to put our e-mail on there as
> well.

Be aware that you will have further problems if you are using uw-imapd
and Outlook or Outlook Express: uw-imapd is not very helpful in terms of
having lots of mail folders. Also you have to basically recompile
everytime you want to change something, and I even resulted to editing
code to be able to hack it to work with my setup. I think by now you
should simply be looking at Cyrus. Pegasus and Eudora are both good
email clients for windows (no flames please) with good, tested, IMAP
support. Eudora is certainly more pleasant on the eye, but I find
pegasus faster. It depends what you want.

> Unfortunately, I can't grasp how to get everything working together. 
> Does fetchmail automagically filter things through procmail once the
> latter is set up?  How do I get procmail to play nice with IMAP
> folders?  Does it matter if I use mbox or maildir format?

If you use Cyrus as I suggest you do, then the email is stored in a
non-standard format anyway. There are plenty of docs out there (check
the cyrus website) for info on passing to .forward files and from there
to procmail. However, Cyrus does also make use of Sieve as a built in
filtering language. I never needed this when I was setting up cyrus, but
if you get to grips with it, then it will simplify the setup and will
probably be as effective for most purposes as procmail.

Fetchmail will fetch the emails from the server. It can then mark it as
being for a specific person (check man fetchmail). It then passes it to
the MTA (exim, postfix, sendmail etc) which then goes to deliver it.
Postfix is capable of then passing it directly to cyrus or to procmail
depending how it is setup. Check /etc/postfix/main.cf if you're going to
use postfix.

> Also, I'm not sure how to set up exim, or if there's another alternative
> that would be better suited for what I want to do.  I've noticed that if
> I get any mail from cron it sits in my local mailbox on each machine, so
> I get the new mail notice when I log in to that machine.  It would be
> nice if all the machines on the network could send stuff to my central
> IMAP inbox.

Well I use postfix almost exclusively. No real reason except I like the
way it has many transports setup and the way you can configure it. It
also has nice easy virtual host setups, but you wont need that for this
I suspect.

There are docs at the Cyrus website for setting up Postfix with Cyrus
and they are easy to follow.

To get cron to send to your IMAP box, simply run a light MTA on your
local machine, and set your ~/.forward file to:
[your-username]@[imap-server-name]

Thus when cron tries to deliver to you, it will instead pass the email
to exim, exim will see the .forward file and the email will be sent off
to you at your imap server account.

> Do I need to really worry about remote mail routing, or should I just
> tell my mail client to connect directly to my ISP's SMTP server (the way
> it is now)?  With only two users, I can't really think of a reason I'd
> need to send mail internally other than messages from cron, and they
> don't use my mail client anyway.

Depends. If you ISP has declared that the IP address assigned to you
should not be used for mail sending then any destination address that is
using Exim with the Realtime Blackhole filter will refuse to deliver
your email. If you regularly send to that address then you must use your
ISP's SMTP server. Otherwise you can basically get away with using your
own server as the SMTP server. That's how I run things here and I'm on a
dialup. The one main advantage is that you have all of the maillogs
available to you, so it is far easier to check whether emails were
really sent, and whether they were accepted for delivery or not.

The only other thing to think of is: if you are working on your linux
workstation, then you use that workstation as the SMTP server, but set a
smarthost as your ISP's SMTP server so that you keep the logs and the
email is still delivered via your ISPs SMTP server.
Actually, maybe you should simply set up your IMAP server so that that
also does the same thing. That should be the best of both worlds: infact
better, because all the mail logs from all of the machines would then be
in the same place.

> Our ISP gives us up to 6 e-mail accounts.  One thing I'd like to do is
> set up one or more of them so that any mail sent to that address will be
> forwarded to both of us.  My thinking is to create a dummy user account
> that receives the e-mail from the special address, then that account's
> procmail settings forward the message to both of our regular accounts. 
> I want two copies, not just a single IMAP inbox that we both access
> (then we get questions like "did you read that?  Can I delete it?")

I know that procmail and mailfilter/maildrop can copy emails, but I
simply don't know enough about sieve to know whether that can do it too.
Certainly with Cyrus, the read/unread status is individual to the user,
but there is still no way that you can tell whether the other person has
read the email. Oh, if you set up aliases, then you can have fetchmail
deliver to the user 'both_of_us' and then in /etc/aliases, have:
both_of_us	myself	other_person
and I think that will work correctly. Check the man pages. Also never
forget to run postalias /etc/aliases when you update aliases if you are
running postfix. (just checked the man page, and it looks like it
should work that way).

> The reason I want to use procmail is I'm hoping once I get that set up,
> I can then do some intelligent filtering on messages.  Some things
> should go to me, some things to my wife, and some things to both of us.

Any decent filtering language should be able to do this. You can even do
some simple filtering in fetchmail. You really shouldn't have to rely on
procmail here: I use maildrop/mailfilter here with by uw-imap setup[1]
and sieve is built into Cyrus, and that should be suitable for most
filtering setups.

> Well, that's about all I can think of so far.  I'm still in the planning
> stages, but I'm hoping that good planning will lead to easier
> implementation.

Unfortunately because POP is so popular, IMAP hasn't really seen as much
development as one would like. Thus whilst it is very easy indeed to set
up a POP server, it is realatively difficult to set up a proper IMAP
server and get it all filtering correctly. You need to read a lot of
documentation and really understand what you're reading. I would
strongly recommend that you use the Cyrus IMAP server: it is far more
flexible. I never came across any docs showing how to set it up with
exim, but then I wasn't looking. I know it can be setup with Postfix and
with sendmail.

Don't expect this to be setup quickly: it takes a lot of reading and
time before this all starts to slot together. If you need any more
advice, just ask!

[1] Yes, I do still use uw-imapd here despite what I've said. The only
reason I use it is because I'm lazy and havn't got round to switching
over, and also uw-imapd reads mail in standard mbox files and as a
result seems slightly faster in sending 6000 emails in a mailing list
over the wire to mutt. Having said that, the tests that I made were not
on identicle hardware, so you probably shouldn't read into that that
cyrus is slower. You certainly won't notice it unless you're fetching
thousands of emails.

Good luck,

Matthew

-- 

Matthew Sackman
Nottingham
England

BOFH Excuse Board:
Zombie processes haunting the computer


-- 
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: