Set up an imap service

From LinuxIntro
Jump to: navigation, search

Contents

imap server

set it up

To set up your imap server, use

yast -i courier-imap

configure it

Add

AUTHMODULES="authpwd"

to /etc/courier/imapd. This makes that imap users can authenticate as the local users in /etc/passwd.

start it

/etc/init.d/saslauthd start
/etc/init.d/courier-imap start

verify it is running

tweedleburg:/mnt/loop/suse/x86_64 # nmap localhost

Starting Nmap 4.20 ( http://insecure.org ) at 2008-08-05 06:30 CEST
Interesting ports on localhost (127.0.0.1):
Not shown: 1688 closed ports
PORT     STATE SERVICE
22/tcp   open  ssh
25/tcp   open  smtp
111/tcp  open  rpcbind
143/tcp  open  imap

verify you can login

Create a test user to see if you can login to your imap server:

useradd -m testuser

Set password as test password using the command

passwd testuser

Use telnet to connect directly to port 143, the imap-port:

telnet localhost 143
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
* OK [CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE ACL ACL2=UNION] Courier-IMAP ready. Copyright 1998-2005 Double Precision, Inc.  See COPYING for distribution information.

Type the imap-command for logging in

1 LOGIN testuser password
* BYE [ALERT] Fatal error: Maildir: No such file or directory
Connection closed by foreign host.

Now do a

mkdir /home/testuser/Maildir
chown testuser:users /home/testuser/Maildir

TroubleShooting

If you get

The connection to the server was unexpectedly closed or timed out. It will be re-established automatically if possible

Make sure your user has a folder Maildir in his home directory, and mail gets delivered there.