View previous topic :: View next topic |
Author |
Message |
arrowood n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
![](images/avatars/gallery/The Matrix/movie_the_matrix_neo.gif)
Joined: 15 Mar 2004 Posts: 34
|
Posted: Sun Apr 03, 2005 10:48 pm Post subject: Howto: Easy IMAP for a home/small network |
|
|
What?
This is a short write up of how to install and configure a simple IMAP solution for a small home network. It only took about 30 minutes on my 1Ghz machine, including compile time and configuration. My requirements were to be easy to install and configure, and low maintenance ongoing.
Why?
I have swapped email clients several times over the last few years. Outlook to Evolution to KMail to Outlook Express and finally Thunderbird. Each time I had to painfully convert my mail to various formats.
Using IMAP allows me to use any mail client that supports IMAP without changing the format that the email is stored in. This is especially nice since I can use my Windows box or one of my Linux boxes and access the same email, using different clients. Before IMAP I had a network share of my email files and made sure I always used the same client (Thunderbird recently). It was slow and could get corrupted easily.
Another benefit is that after doing this, it is easy to setup a web-mail interface to your IMAP server so you can retrieve your email anywhere.
How?
If you are used to a desktop mail client then some of this may be unfamiliar to you so I will explain it first before we jump in. We will use "fetchmail" to retrieve the mail from our mail server (my ISP's pop3 server in my case). Fetchmail then will hand off the email to "procmail" which can do various processing of the email. We will just set it up to dump it in a Maildir folder, but you can add a lot of functionality here if you like (sorting, virus scanning, etc). We will set up a cronjob to pull the email every so often. Finally, we will install an IMAP server so that our mail client(s) can access the email.
Everyone has their favorite software. With IMAP, there are a few choices:
The first three are the "big three" while Binc is relatively new. Here are some details and opinions on the feature/pros/cons of the big three:
http://www.coruscant.demon.co.uk/mike/imap/software.html
http://lists.debian.org/debian-isp/2005/03/msg00146.html
I choose Binc because:
- it is much smaller than the other choices
- its only job in life is to handle IMAP; Nothing else.
- has a focus on security
- is easy to configure
- is easy to maintain
If you are considering Binc, I highly recommend reading the FAQ on their website. I found it very informative and useful.
You may disagree with me on some points above; Please - no flames; I am simply telling you why this was the right choice for *me*. You are free to install whatever you wish.
Okay, let's get busy.
Steps
NOTE: In the code below, please note that some commands are to be done as root and other as non-root. Look for "#" for root and "$" for non-root commands.
1. Install fetchmail
Code: | $ touch ~/.fetchmailrc
$ chmod 600 ~/.fetchmailrc
$ vi ~/.fetchmailrc |
Add the following to the file, changing the fields to the relevant values
Code: |
poll your-mail-server
protocol pop3
username your-username
password your-password
mimedecode
mda "/usr/bin/procmail -d %s" |
I have had success pulling my gmail account via fetchmail also; Be sure and enable the pop options in your gmail settings on their website.
Code: | poll pop.gmail.com with proto POP3 port 995 and options uidl
user 'YOUR_USER_NAME@gmail.com' there with password 'YOUR_PASS' is 'LOCAL_USERNAME' here ssl fetchall keep
mda "/usr/bin/procmail -d %s" |
To download from multiple email accounts just repeat the above lines in the file.
2. Install procmail
Code: | $ mkdir ~/Maildir
$ touch ~/.procmailrc
$ chmod 600 ~/.procmailrc
$ vi ~/.procmailrc |
Add this to the file:
Code: | DEFAULT=$HOME/Maildir/INBOX/
LOGFILE=$HOME/.procmaillog |
3. Install bincimap
Code: | # emerge bincimap
# vi /etc/bincimap/bincimap.conf |
Change the depot value in the file
Set bincimap to start on startup:
Code: | # ln -s /etc/bincimap/service/bincimap /service/bincimap
# /etc/init.d/svscan restart |
(OPTIONAL) This command will setup bincimap-ssl on your system: (IF YOU CHOOSE NOT TO USE SSL, then you will need to edit bincimap.conf to allow non-ssl connections.)
Code: | # ebuild /var/db/pkg/net-mail/bincimap-1.2.11/bincimap-1.2.11.ebuild config |
4. Finishing up
You can now download your email manually:
Since you probably want it happen auto-magically, lets add a cron job to pull it.
Add this line to pull every 15 minutes or modify it to a different time interval:
Code: | 00/4 * * * * fetchmail |
Don't forget to reconfigure your mail clients to use IMAP.
Now you can install a web mail interface if you like.
Credit
http://forums.whirlpool.net.au/forum-replies.cfm?t=316099
Large chunks of this were taken from this similar writeup. I wanted to reproduce it (with enhancements) here because I think it is valuable to the Gentoo community and would be easier to find here.
Many thanks to vorticon for sharing that. You made my life much easier when I did my install.![Very Happy :D](images/smiles/icon_biggrin.gif)
Last edited by arrowood on Mon Apr 04, 2005 12:24 am; edited 1 time in total |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
RBH Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
Joined: 31 Oct 2004 Posts: 184
|
Posted: Sun Apr 03, 2005 11:44 pm Post subject: |
|
|
I'd been considering doing this - now I definitely will! Many thanks ![Smile :)](images/smiles/icon_smile.gif) |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Physaro n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 24 Nov 2003 Posts: 17
|
Posted: Sun Jun 12, 2005 9:20 am Post subject: |
|
|
Woow, this guide rocks.
Its soo easy to setup a working IMAP serverr with your guide, thank you!!! |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
tekknokrat Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
Joined: 17 Apr 2005 Posts: 278 Location: Magdeburg
|
Posted: Tue Aug 23, 2005 10:31 pm Post subject: configuration doesnt work |
|
|
Perhaps there some changes in development within the last month but i couldn't get it to work with this short stepbystep guide.
After some 10h investigation i found out that the messages must be placed in the "cur" directory under "INBOX/" which was never mentioned here.
Can someone tell me how to smoothly workaround that within the config of fetch/procmail/bincimap.
Should i change mda's default path or should I create a symlink from INBOX -> cur? For what reasons do I need cur, new and tmp directory?
Cheers |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
MikeP Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 27 Feb 2003 Posts: 115 Location: Germany
|
Posted: Mon Aug 29, 2005 12:49 pm Post subject: |
|
|
http://cr.yp.to/proto/maildir.html
Edit: this link is even better: http://www.qmail.org/qmail-manual-html/man5/maildir.html
You can find details there, including what new, cur and tmp are for.
Anyway, i have a similar setup, i just chose dovecat as IMAP server (havent yet checked bincs page), its supposed to be very secure aswell.
Also i used maildrop instead of procmail, because its language seems to be nicer.
Finally, i use postfix as an MTA and let fetchmail relay mail to port 25 - with this setup, i can also use the server for sending mails (also to local accounts) and directly receiving mails adressed to the servers IP/dns name.
While this isn't that important, i primarily made it to learn about postfix/mail servers.
It also might be nice when you send larger mails often, because the mail will be sent to the server via a fast lan connection first, then the server forwards it via the rather slow DSL/cable/dialup connection, so even larger mails appear to be sent quite fast.. ![Smile :)](images/smiles/icon_smile.gif) |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
bdemore n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
![](images/avatars/gallery/Simpsons/Simpsons_-_Krusty.jpg)
Joined: 22 Oct 2002 Posts: 67
|
Posted: Sat Oct 01, 2005 5:56 pm Post subject: Sending Mail |
|
|
How do you send mail with this system? |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
jmk Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
![](images/avatars/18277608834190da1a37e79.png)
Joined: 07 Jul 2003 Posts: 130 Location: Stockholm
|
Posted: Tue Oct 04, 2005 8:49 am Post subject: Re: Sending Mail |
|
|
bdemore wrote: | How do you send mail with this system? |
You don't. This setup is retreval only.
If you want to send, set your mua to the smtp address of your isp as you would do normally.
You could also use a package like esmtp, ssmtp or nbsmtp to get mail of your box to a relay host (your isp). But i's not nessasary to do so.
Oh and arrowood,
Thanks for a good guide. It has reduced the complexity of my email setup alot. ![Very Happy :D](images/smiles/icon_biggrin.gif) _________________ Adopt an unanswered post today.
Join the adopt an unanswered post initiative. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
RBJ1128 Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
![](images/avatars/gallery/Monkey Island/Monkey_Island_-_Monkey2.gif)
Joined: 18 Jan 2005 Posts: 192
|
Posted: Thu Oct 13, 2005 12:23 pm Post subject: |
|
|
MikeP wrote: |
Finally, i use postfix as an MTA and let fetchmail relay mail to port 25 - with this setup, i can also use the server for sending mails (also to local accounts) and directly receiving mails adressed to the servers IP/dns name.
While this isn't that important, i primarily made it to learn about postfix/mail servers.
It also might be nice when you send larger mails often, because the mail will be sent to the server via a fast lan connection first, then the server forwards it via the rather slow DSL/cable/dialup connection, so even larger mails appear to be sent quite fast.. ![Smile :)](images/smiles/icon_smile.gif) |
How did you set up postfix as the MTA? Thanks. _________________ -RBJ1128 |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
adsmith Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
Joined: 26 Sep 2004 Posts: 1386 Location: NC, USA
|
Posted: Thu Oct 13, 2005 12:24 pm Post subject: |
|
|
Nice write-up, though I saw no mention of dovecot which is (also) dead simple to set up and works beautifully. I once looked into Binc, but I decided to stick with dovecot. I don't remember why, though. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
KernelFolla n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
![](images/avatars/189744525842480b2bcfca6.jpg)
Joined: 28 Mar 2005 Posts: 8 Location: Bari Italy
|
Posted: Wed Nov 09, 2005 6:46 pm Post subject: |
|
|
great tutorial.
I've imap too
Exists one way to start fetchmail when someone calls imap? |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
jonnevers Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
![](images/avatars/182916767547279b4f55dc0.png)
Joined: 02 Jan 2003 Posts: 1594 Location: Gentoo64 land
|
Posted: Wed Nov 09, 2005 7:30 pm Post subject: |
|
|
adsmith wrote: | Nice write-up, though I saw no mention of dovecot which is (also) dead simple to set up and works beautifully. I once looked into Binc, but I decided to stick with dovecot. I don't remember why, though. |
Using courier-imap over the years has created a very foul taste in my system administrative mouth. (so to speak)
I finally had enough two weeks ago and found dovecot while looking for a replacement.
Dovecot is everything courier-imap is not. Small, FAST (courier-imap used to timeout on certain operations on my system, without any errors logged), designed to be secure, and very simple to configure.
anyone looking for a reliable IMAP daemon, take a look into dovecot. For a nice webmail system, postfix + dovecot + roundcube is very robust and very simple to administer.
- Jon |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
NotQuiteSane Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
![](images/avatars/198107084420f140a8786a.jpg)
Joined: 30 Jan 2005 Posts: 488 Location: Klamath Falls, Jefferson, USA, North America, Midgarth
|
Posted: Sat Nov 26, 2005 8:34 am Post subject: Re: Howto: Easy IMAP for a home/small network |
|
|
arrowood wrote: |
Code: | # ebuild /var/db/pkg/net-mail/bincimap-1.2.11/bincimap-1.2.11.ebuild config |
|
this command returns nothing on my server. just an empty line. (using, of course the version present on my box)
NQS _________________ These opinions are mine, mine I say! Piss off and get your own.
As I see it -- An irregular blog, Improved with new location
To delete French language packs from system use 'sudo rm -fr /' |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
dnas n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
![](images/avatars/35495859842e239cca3261.gif)
Joined: 26 Jun 2004 Posts: 35 Location: Belgium
|
Posted: Wed Dec 28, 2005 9:26 pm Post subject: |
|
|
NotQuiteSane,
you should check if the file /etc/bincimap/bincimap.pem exists, if it does you will get an empty line every the command
grtz _________________ All Information Should Be Free |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
capitanjackal n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
![](images/avatars/gallery/Simpsons/simpsons_mrburns.gif)
Joined: 26 Aug 2003 Posts: 69 Location: Quarata (CALIFORNIA)
|
Posted: Sun Apr 09, 2006 1:49 pm Post subject: |
|
|
when I try to connect to imap-ssl I receive:
@4000000044390f511ccc8924 9244 0 [unknown@127.0.0.1:] error initializing Binc IMAP: SSL negotiation failed: Unexpected EOF
the ebuild config created regularly the bincimap.pem with two parts (rsa key and cert)
any idea ?
thanks
Giacomo _________________ Meglio una Fiat 500 con 500 watts che una Fiat Punto con punti watts!
PS: ho comprato la punto! sono un l00s3r |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
zeek Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
![](images/avatars/gallery/Star Wars/movie_star_wars_c-3p0.gif)
Joined: 16 Nov 2002 Posts: 480 Location: Bantayan Island
|
Posted: Sun Apr 09, 2006 6:36 pm Post subject: |
|
|
capitanjackal wrote: | any idea ? |
emerge dovecot
Seriously. Because its IMAP, you don't need to move/convert any of your mail. Just emerge dovecot, make a pass on the config file and start it. I used to have nothing but problems with courier, binc was a config nightmare, cyrus and uw could not handle the massive maildirs I had. Save yourself the hassle, don't bother with those IMAP servers because they all have problems.
Dovecot just works. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
capitanjackal n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
![](images/avatars/gallery/Simpsons/simpsons_mrburns.gif)
Joined: 26 Aug 2003 Posts: 69 Location: Quarata (CALIFORNIA)
|
Posted: Sun Apr 09, 2006 7:03 pm Post subject: |
|
|
I can't reach to make work dovecot with vpopmail.
the best remain courier-imap, about 20 mail server installed with qmail and courier-imap without problems.
Giaco _________________ Meglio una Fiat 500 con 500 watts che una Fiat Punto con punti watts!
PS: ho comprato la punto! sono un l00s3r |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
schutzaus n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
![](images/avatars/238090712443b927518185.gif)
Joined: 24 Mar 2006 Posts: 2
|
Posted: Tue Apr 11, 2006 9:33 am Post subject: Speed perception ? |
|
|
Hi,
I just went through this HowTo and it worked GREAT! So Thank you again
BUT: In my opinion the imap account behaves kind of slow ?
First my setup:
My gentoo box is connected to my 54mbit Wlan Router via cable.
I access imap with: Apple Mail (over WLAN/PowerBook) and Thunderbird 1.5 (over WLAN/WinXP).
Both WLAN connections are fine ... so i rule them out for causing the delay.
The noticable delay is with Apple Mail ... it takes up to 30 seconds to refresh the folders ... Thunderbird seems to work fine ... but i get strange "folder echos" (I have missplaced a folder with apple mail, made it a subfolder of Trash .... then moved it back to where its supposed to be, now in Thunderbird i always get this subfolder in trash ... when I delete it ti's gone until the next restart of Thunderbird ? in Mail its fine)
The main question is ... how long does it usually take for information sent by one client to propagate through the system to then get synced to antoher client ? (I have like 600 mails in my "Sent" folder) Is it possible that those mails reduce the update speed of imap ?
Is there any way to speed it up but at the same time keep the mails available ?
For example: I told Thunderbird and Mail to keep an offline copy of the imap Mails so i can read them when I'm not connected.
Can i tell imap or Thunderbird/Mail to only sync the new/changed Mails ? |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Atlas95 n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 07 Jan 2006 Posts: 12 Location: France
|
Posted: Sat May 20, 2006 10:14 am Post subject: |
|
|
Hello, this is a very great howto!
It is the only howto which is working on my computer, I would like to install roundcube webmail with this...
how to do?
I have the webserver and roundcube on my computer but how to config roundcube please?
I'm yet a newbie please help me
Best regards ![Smile :)](images/smiles/icon_smile.gif) |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
thecooptoo Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
Joined: 27 Apr 2003 Posts: 1353 Location: UK
|
Posted: Sat Jun 17, 2006 9:52 am Post subject: so whats wrong here? |
|
|
I can pick up mail
Code: | grenada ~ # fetchmail -k -f /etc/fetchmailrc
fetchmail: WARNING: Running as root is discouraged.
1 message for user at isp.co.uk (1371 octets).
reading message user@isp.co.uk:1 of 1 (1371 octets) . not flushed
grenada ~ # |
Code: | grenada ~ # cat /etc/bincimap/bincimap.conf |grep ^[A-Za-z0-9\ ]
Authentication {
allow plain auth in non ssl = "yes", /* allow login or
authenticate
when not in
SSL/TLS mode */
auth penalty = 4, /* on auth failure,
disable starttls = "no"
Security {
jail path = "/usr/bin",
jail user = "nobody",
jail group = "nobody"
Log {
type = "syslog", /* supports
environment ip variable = "TCPREMOTEIP"
Mailbox {
depot="IMAPdir"
type = "Maildir", /* only Maildir
path = "Maildir", /* default path */
auto create inbox = "yes", /* create INBOX in
auto subscribe mailboxes = "INBOX", /* list mailboxes
umask = "077" /* use this umask
Session {
idle timeout = 1860, /* idle timeout in
auth timeout = 60, /* timeout before
transfer timeout = 1200, /* timeout per
transfer buffer size = 1024 /* number of bytes
to buffer before
passing on to
client. */
SSL {
pem file = "/etc/bincimap/bincimap.pem", /* private key and
certificate
chain PEM file
name */
ca file = "", /* file to use as
certificate
authority */
ca path = "", /* path to search
for more certificate
authorities */
cipher list = "!ADH:RC4+RSA:HIGH:MEDIUM:LOW:EXP:+SSLv2:+EXP",
verify peer = "no"
/* $Id: bincimap.conf.in,v 1.2 2003/08/23 12:53:25 andreaha Exp $ */
grenada ~ #
|
but then , taken from the bincimap FAQ
Code: | grenada# telnet localhost 143
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
* OK Welcome to Binc IMAP Copyright (C) 2002-2005 Andreas Aardal Hanssen at 2006-06-17 10:30:33 BST
1 LOGIN "user" "pass"
1 OK LOGIN completed
2 LIST "" "%"
* LIST (\Noselect) "/" "INBOX"
2 OK LIST completed
3 CREATE mailbox
3 NO CREATE failed: With a Maildir++ depot, you must create all mailboxes under INBOX. Try creating INBOX/mailbox.
3 CREATE INBOX/mail
3 OK CREATE completed
4 RENAME INBOX/mail INBOX/renamed
4 OK RENAME completed
5 DELETE INBOX/renamed
5 OK DELETE completed
6 SELECT INBOX
6 NO SELECT failed: No such mailbox "INBOX"
Connection closed by foreign host.
grenada #
grenada # cat /etc/procmailrc
# Use maildir-style mailbox in user's home directory
#DEFAULT=$HOME/.maildir/
DEFAULT=$HOME/Maildir/INBOX/
LOGFILE=$HOME/.procmaillog
grenada maureva #
|
so what have i done wrong ? _________________ join the optout - http://nhsconfidentiality.org |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Cr0t l33t
![l33t l33t](/images/ranks/rank_rect_4.gif)
![](images/avatars/42b615a33cca046d6e0c9.gif)
Joined: 27 Apr 2002 Posts: 945 Location: USA
|
Posted: Sun Nov 19, 2006 10:19 am Post subject: |
|
|
Does anyone know how to combine this with spamkiller? _________________ cya |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|