View previous topic :: View next topic |
Author |
Message |
avx Advocate
Joined: 21 Jun 2004 Posts: 2152
|
Posted: Fri May 27, 2011 11:14 am Post subject: [solved] local IMAP server, best way for a single user? |
|
|
So after ~15 years of using email, I admit I still don't fully understand everything working behind the scenes and I'd like to request some help.
Currently I'm having various accounts related to my domains (normal webspace in this case, ie no v-/root), plus some gmail, plus work. My provider only offers me a simple webui, which I can use to fool around with spamassassin to decide what's ham and what's spam, but that's it - I can create (imap) folders, but I can't create rules to move messages.
Since I want to be somewhat free in choosing the clients I use, I thought about running a local IMAP server and feeding it via fetch-/procmail/fdm/etc.
I had a quick look at the documentation of courier and dovecot, but I found it to be not quite as easy to understand as I'd like it to be.
Basically, I want something like this:
remote server* -> fetch* -> filter* -> maildirs* -> local imap -> client* -> msmpt/something -> remote server*
Everything with a * is clear to me, but I don't know what best to use for the other stuff, so some help is appreciated. _________________ ++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
Last edited by avx on Wed Jun 01, 2011 1:50 am; edited 2 times in total |
|
Back to top |
|
|
Etal Veteran
Joined: 15 Jul 2005 Posts: 1932
|
Posted: Fri May 27, 2011 4:19 pm Post subject: |
|
|
I don't have an internal IMAP server anymore (I just use mutt on the maildir :P) but I've previously set up courier-imap, and it was extremely easy.
All you have to do is edit the config file to set the correct path to maildirs, make it listen only to localhost, and reduce the number of processes. I guess the only tricky part was to make sure your maildirs are in a proper hierarchy for IMAP. (If you don't want to change the actual layout, you can just use a separate directory for imap, with symlinks to the right places.)
For sending, I use msmtp. It's nice because you can use it with different email accounts - it looks at the From address, and matches it to the right SMTP server. You can set it as the "sendmail command" in the email client. _________________ “And even in authoritarian countries, information networks are helping people discover new facts and making governments more accountable.”– Hillary Clinton, Jan. 21, 2010 |
|
Back to top |
|
|
s_bernstein Apprentice
Joined: 11 Mar 2006 Posts: 172 Location: Bremen, Germany
|
Posted: Sat May 28, 2011 7:14 am Post subject: |
|
|
I'm having a similar setup like you want to build. For the reason was that I was tired of setting up all my email accounts and email filters on various computers and notebooks. So now I use getmail to fetch all the mail from the different mail servers (wrote a little script that will scan all user home folder for getmail setup files). Then I user maildrop to sort the mails into different imap folders. For the imap server I use dovecot, but I guess you can use any imap server you want.
I also wrote a little init-script which will insert and remove the cron job to fetch mail every x minutes. |
|
Back to top |
|
|
avx Advocate
Joined: 21 Jun 2004 Posts: 2152
|
Posted: Sat May 28, 2011 12:55 pm Post subject: |
|
|
s_bernstein, would you mind showing me your dovecot-config, maybe I'll understand it better when it's just a simple config and not some of the complex stuff on their homepage.
Mutt & maildirs directly would be nice, but I can't be certain to always have a system in front of me, allowing to use ssh to go back to my server, so once I made sure it's running the way I want it, I think putting something like squirrel/roundcube on top would be rather easy for that situations. _________________ ++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>. |
|
Back to top |
|
|
s_bernstein Apprentice
Joined: 11 Mar 2006 Posts: 172 Location: Bremen, Germany
|
Posted: Sun May 29, 2011 8:04 am Post subject: |
|
|
Sure, but it's really quite straight forward. The config files for gentoo are well documented and almost self explaining. I didn't do any big changes. These things I changed compared to the default setup:
In dovecot.conf (only support imap and ipv4):
- protocols = imap
- listen = *
In conf.d/10-auth.conf (disable plaintext auth and set auth mode):
- disable_plaintext_auth = yes
- auth_mechanisms = plain login
- !include auth-system.conf.ext
In conf.d/10-mail.conf (setup mail folder and privileges):
- mail_location = maildir:/var/spool/mail/%u
- mail_privileged_group = mail
In conf.d/10-ssl.conf (Enable ssl):
- ssl = yes
- ssl_cert = </etc/ssl/dovecot/server_cert.pem
- ssl_key = </etc/ssl/dovecot/server_key.pem
But in general, dovecot should run just fine in the defautl config. |
|
Back to top |
|
|
avx Advocate
Joined: 21 Jun 2004 Posts: 2152
|
Posted: Mon May 30, 2011 2:53 pm Post subject: |
|
|
So basically I did just the same as you, except for the mail_privileged_group (for now) and I set the location to be maildir:/%h/%u/.maildir.
For testing, I added the account data (localhost, imap, $user, $pwd) in claws-mail, which according to the log connects successfully, but it doesn't show any mail _________________ ++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>. |
|
Back to top |
|
|
s_bernstein Apprentice
Joined: 11 Mar 2006 Posts: 172 Location: Bremen, Germany
|
Posted: Mon May 30, 2011 3:22 pm Post subject: |
|
|
You can't have any email in you imap folder unless you receive emails. So, if you do not want to setup a full featured mail server (which will be troublesome for various reasons on a dial-in connection) you now need something to collate your mails from your "real" mail server. I use getmail for this. The thing about getmail is, that you can fetch mails by varoius protocols like imap or pop or fetchmail. You could even fetch multiple accounts on one server with one call of getmail, although I never tried that. |
|
Back to top |
|
|
avx Advocate
Joined: 21 Jun 2004 Posts: 2152
|
Posted: Mon May 30, 2011 3:41 pm Post subject: |
|
|
It's not that the .maildir is empty, I used `fdm` (sort of fetch/proc-mail combined) to fetch some mail from my server and it correctly stored them, ie there are now INBOX/{cur,new,tmp} + some other boxes in the maildir, I can look/read through them via ie `less` - so that should not be the problem. _________________ ++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>. |
|
Back to top |
|
|
s_bernstein Apprentice
Joined: 11 Mar 2006 Posts: 172 Location: Bremen, Germany
|
Posted: Mon May 30, 2011 4:40 pm Post subject: |
|
|
If your content is correct, you - or better dovecot - is lacking the right permissions to read,write and execute on these dirs. |
|
Back to top |
|
|
avx Advocate
Joined: 21 Jun 2004 Posts: 2152
|
Posted: Mon May 30, 2011 5:46 pm Post subject: |
|
|
Don't think so, I already tried `chmod -R 777 ~/.maildir` - no change. Even if that would be the case, shouldn't there be anything related to it in the logs?
Edit, closing claws, reopening it at clicking the inbox gives the following in network-log: Quote: | [19:49:56] IMAP4< * OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE STARTTLS AUTH=PLAIN AUTH=LOGIN] Dovecot ready.
* IMAP connection is un-authenticated
[19:49:56] IMAP4> 1 CAPABILITY
[19:49:56] IMAP4< * CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE STARTTLS AUTH=PLAIN AUTH=LOGIN
[19:49:56] IMAP4< 1 OK Pre-login capabilities listed, post-login capabilities have more.
[19:49:56] IMAP4> Logging avx to 10.0.0.10 using LOGIN
[19:49:56] IMAP4< Logged in
[19:49:56] IMAP4< Login to 10.0.0.10 successful
[19:49:56] IMAP4> 3 LIST "" ""
[19:49:56] IMAP4< * LIST (\Noselect) "." ""
[19:49:56] IMAP4< 3 OK List completed.
[19:49:56] IMAP4> 4 STATUS INBOX (MESSAGES UIDNEXT UIDVALIDITY UNSEEN)
[19:49:56] IMAP4< * STATUS "INBOX" (MESSAGES 0 UIDNEXT 1 UIDVALIDITY 1306725813 UNSEEN 0)
[19:49:56] IMAP4< 4 OK Status completed. | The bold part looks a little strange to me.
For the same action, global log (/var/log/everything/current) just states: Quote: | May 30 19:49:56 [dovecot] imap-login: Login: user=<avx>, method=PLAIN, rip=10.0.0.10, lip=10.0.0.10, mpid=9766, secured |
Doing the same action on an imap account from my provider, the log gives the following: Quote: | [19:54:20] IMAP4< * OK Dovecot ready.
[19:54:20] IMAP4> 1 STARTTLS
[19:54:20] IMAP4< 1 OK Begin TLS negotiation now.
* IMAP connection is un-authenticated
[19:54:20] IMAP4> 2 CAPABILITY
[19:54:21] IMAP4< * CAPABILITY IMAP4rev1 SASL-IR SORT THREAD=REFERENCES MULTIAPPEND UNSELECT LITERAL+ IDLE CHILDREN NAMESPACE LOGIN-REFERRALS AUTH=PLAIN
[19:54:21] IMAP4< 2 OK Capability completed.
[19:54:21] IMAP4> Logging [redacted] to [redacted] using LOGIN
[19:54:21] IMAP4< Logged in.
[19:54:21] IMAP4< Login to [redacted] successful
[19:54:21] IMAP4> 4 LIST "" ""
[19:54:21] IMAP4< * LIST (\Noselect) "." ""
[19:54:21] IMAP4< 4 OK List completed.
[19:54:21] IMAP4> 5 STATUS INBOX (MESSAGES UIDNEXT UIDVALIDITY UNSEEN)
[19:54:21] IMAP4< * STATUS "INBOX" (MESSAGES 298 UIDNEXT 7050 UIDVALIDITY 1147218138 UNSEEN 0)
[19:54:21] IMAP4< 5 OK Status completed.
[19:54:21] IMAP4> 6 SELECT INBOX
[19:54:21] IMAP4< * FLAGS (\Answered \Flagged \Deleted \Seen \Draft $NotJunk $Junk KMAILFORWARDED KMAILTODO KMAILWATCHED KMAILIGNORED $FORWARDED $TODO $WATCHED $IGNORED Old later $Label1 $Label2 $Label3 $Label4 $Label5)
[19:54:21] IMAP4< * OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen \Draft $NotJunk $Junk KMAILFORWARDED KMAILTODO KMAILWATCHED KMAILIGNORED $FORWARDED $TODO $WATCHED $IGNORED Old later $Label1 $Label2 $Label3 $Label4 $Label5 \*)] Flags permitted.
[19:54:21] IMAP4< * 298 EXISTS
[19:54:21] IMAP4< * 0 RECENT
[19:54:21] IMAP4< * OK [UIDVALIDITY 1147218138] UIDs valid
[19:54:21] IMAP4< * OK [UIDNEXT 7050] Predicted next UID
[19:54:21] IMAP4< 6 OK [READ-WRITE] Select completed.
[19:54:21] IMAP4- [fetching flags...]
[19:54:21] IMAP4> 7 UID FETCH 1:* (FLAGS UID)
[19:54:21] IMAP4< [FETCH data - 1024 bytes]
[19:54:21] IMAP4< [FETCH data - 1024 bytes]
[19:54:21] IMAP4< en) UID 6603)
[19:54:21] IMAP4< [FETCH data - 1024 bytes]
[19:54:21] IMAP4< [FETCH data - 1024 bytes]
[19:54:21] IMAP4< AGS (\Seen) UID 6762)
[19:54:21] IMAP4< [FETCH data - 1024 bytes]
[19:54:21] IMAP4< [FETCH data - 1024 bytes]
[19:54:21] IMAP4< AGS (\Seen) UID 6855)
[19:54:21] IMAP4< [FETCH data - 1024 bytes]
[19:54:21] IMAP4< [FETCH data - 1024 bytes]
[19:54:21] IMAP4< CH (FLAGS (\Seen) UID 6920)
[19:54:21] IMAP4< [FETCH data - 1024 bytes]
[19:54:21] IMAP4< [FETCH data - 1024 bytes]
[19:54:21] IMAP4< (\Seen) UID 6994)
[19:54:21] IMAP4< [FETCH data - 1024 bytes]
[19:54:21] IMAP4< [FETCH data - 673 bytes] |
Edit 2: my ~/.maildir contains all messages which are also in the other account I tried (just filtered to different folders). _________________ ++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>. |
|
Back to top |
|
|
s_bernstein Apprentice
Joined: 11 Mar 2006 Posts: 172 Location: Bremen, Germany
|
Posted: Mon May 30, 2011 8:34 pm Post subject: |
|
|
Seems alright for me up until
Quote: | [19:49:56] IMAP4< 4 OK Status completed. |
After that, your email client is not sending the select to change the currently active imap folder to inbox. Maybe you have to set your email client to look for new emails in that folder or to ceck every folder for new mail? I don't know claws.
Edit:
You could also try to use your imap server with telnet and send the select command by hand to verify your dovecot config.
Edit 2:
You log already showed the problem:
Quote: | [19:49:56] IMAP4> 4 STATUS INBOX (MESSAGES UIDNEXT UIDVALIDITY UNSEEN)
[19:49:56] IMAP4< * STATUS "INBOX" (MESSAGES 0 UIDNEXT 1 UIDVALIDITY 1306725813 UNSEEN 0) |
The first line is your mail client asking the server for status information about the inbox and the second line the response from your server. He's telling your email client that there are 0 old messages and 0 new / unseen messages in this folder. So no action is required. Because your email client is not looking for new messages in other folder, it will stop processing at this point. |
|
Back to top |
|
|
avx Advocate
Joined: 21 Jun 2004 Posts: 2152
|
Posted: Tue May 31, 2011 4:53 pm Post subject: |
|
|
Ah damn, it's just been a typo, had Inbox instead of inbox.
Claws now picks up 'inbox' correctly, now to find out, how to also make the other maildirs available (~/.maildir/{inbox,foo,bar,baz}) since claws doesn't pick them up automatically. _________________ ++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>. |
|
Back to top |
|
|
Etal Veteran
Joined: 15 Jul 2005 Posts: 1932
|
Posted: Tue May 31, 2011 8:16 pm Post subject: |
|
|
For courier-imap, at least, you have to put your other folders as dot-folders, inside your inbox folder. So if your inbox is in ~/Maildir/{cur,new,tmp}, you'd have ~/Maildir/.Sent/{cur,new,tmp}, etc. _________________ “And even in authoritarian countries, information networks are helping people discover new facts and making governments more accountable.”– Hillary Clinton, Jan. 21, 2010 |
|
Back to top |
|
|
avx Advocate
Joined: 21 Jun 2004 Posts: 2152
|
Posted: Wed Jun 01, 2011 1:49 am Post subject: |
|
|
Thank you, that's the hint I needed _________________ ++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>. |
|
Back to top |
|
|
|
|
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
|
|