0

I am setting up an email server for my personal domain. There will only be one user (me). I am running a DigitalOcean VPS on Arch, everything is up to date as of yesterday.

I have got postfix installed and running: when you send an email to my new address, it gets stored in /var/spool/mail/richard.

My problem is with dovecot. Here is a transcript of my interaction with it via telnet:

$ telnet microbug.uk imap
Trying 46.101.26.207...
Connected to microbug.uk.
Escape character is '^]'.
* OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE AUTH=PLAIN] Dovecot ready.
a1 login richard [password]
a1 OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS THREAD=ORDEREDSUBJECT MULTIAPPEND URL-PARTIAL CATENATE UNSELECT CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS BINARY MOVE SPECIAL-USE] Logged in
a2 list "" "*"
* LIST () "." INBOX
a2 NO [SERVERBUG] Internal error occurred. Refer to server log for more information. [2015-06-16 20:58:30] (0.002 secs).

systemctl status dovecot reveals that dovecot wants /var/spool/mail/richard to be a directory (?!):

$ systemctl status dovecot
* dovecot.service - Dovecot IMAP/POP3 email server
   Loaded: loaded (/usr/lib/systemd/system/dovecot.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2015-06-16 19:23:18 UTC; 1h 40min ago
 Main PID: 739 (dovecot)
   CGroup: /system.slice/dovecot.service
           |- 739 /usr/bin/dovecot -F
           |- 740 dovecot/anvil
           |-1396 dovecot/log
           `-1423 dovecot/imap

Jun 16 20:47:20 server dovecot[1360]: imap-login: Login: user=<richard>, method=PLAIN, rip=86.6.26.155, lip=46.101.26.207, mpid=1365, session=<ezk7rqgYLQBWBhqb>
Jun 16 20:50:41 server dovecot[739]: master: Warning: SIGHUP received - reloading configuration
Jun 16 20:50:41 server dovecot[1360]: imap(richard): Server shutting down. in=52 out=1059
Jun 16 20:50:49 server dovecot[1396]: imap-login: Login: user=<richard>, method=PLAIN, rip=86.6.26.155, lip=46.101.26.207, mpid=1401, session=<0kquuqgYWwBWBhqb>
Jun 16 20:53:31 server dovecot[1396]: imap(richard): Error: opendir(/var/spool/mail/richard) failed: Not a directory
Jun 16 20:53:31 server dovecot[1396]: imap(richard): Error: opendir(/var/spool/mail/richard) failed: Not a directory
Jun 16 20:58:04 server dovecot[1396]: imap(richard): Connection closed in=87 out=1077
Jun 16 20:58:23 server dovecot[1396]: imap-login: Login: user=<richard>, method=PLAIN, rip=86.6.26.155, lip=46.101.26.207, mpid=1423, session=<K2y+1agY/QBWBhqb>
Jun 16 20:58:30 server dovecot[1396]: imap(richard): Error: opendir(/var/spool/mail/richard) failed: Not a directory
Jun 16 20:58:30 server dovecot[1396]: imap(richard): Error: opendir(/var/spool/mail/richard) failed: Not a directory

Making /var/spool/mail/richard a directory stops dovecot complaining... but then postfix can't deliver mail.

postconf -n (postfix settings which are different to the default):

alias_database = $alias_maps
alias_maps = hash:/etc/postfix/aliases
command_directory = /usr/bin
compatibility_level = 2
daemon_directory = /usr/lib/postfix/bin
data_directory = /var/lib/postfix
debug_peer_level = 2
debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
html_directory = no
inet_protocols = ipv4
mail_owner = postfix
mail_spool_directory = /var/spool/mail
mailq_path = /usr/bin/mailq
manpage_directory = /usr/share/man
meta_directory = /etc/postfix
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
myhostname = microbug.uk
mynetworks_style = host
myorigin = $mydomain
newaliases_path = /usr/bin/newaliases
notify_classes = bounce, data, delay, policy, protocol, resource, software
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix
sample_directory = /etc/postfix
sendmail_path = /usr/bin/sendmail
setgid_group = postdrop
shlib_directory = /usr/lib/postfix
unknown_local_recipient_reject_code = 550

doveconf -n (dovecot settings which are different to the default):

# 2.2.18: /etc/dovecot/dovecot.conf
# OS: Linux 4.0.5-1-ARCH x86_64  ext4
disable_plaintext_auth = no
mail_location = maildir:/var/spool/mail/%u
mail_temp_dir = /
namespace inbox {
  inbox = yes
  location = 
  mailbox Drafts {
    special_use = \Drafts
  }
  mailbox Junk {
    special_use = \Junk
  }
  mailbox Sent {
    special_use = \Sent
  }
  mailbox "Sent Messages" {
    special_use = \Sent
  }
  mailbox Trash {
    special_use = \Trash
  }
  prefix = 
}
passdb {
  args = scheme=CRYPT username_format=%u /etc/dovecot/users
  driver = passwd-file
}
protocols = imap
ssl = no
userdb {
  args = username_format=%u /etc/dovecot/users
  driver = passwd-file
}

Any help would be deeply appreciated! I can post additional config as required.

EDIT: added config files

(I know this config is insecure but when it's working I'll add SSL)

  • 1
    Welcome to SE. This isn't like many other forums, so please post your answer as an answer and leave the question as a question. – roaima Jun 16 '15 at 21:49
  • Please do as @roaima suggest, and after that accept your own post so that future visitors (like me) know the problem was resolved. – Anthon Jun 16 '15 at 21:54
2

Postfix is delivering to a mailbox file rather than a Maildir.

Try something like this in Dovecot:

mail_location = mbox:~/mail:INBOX=/var/mail/%u

Alternatively, configure postfix to deliver to a Maildir with a command like:

sudo postconf -e "home_mailbox = Maildir/"

And configure Dovecot to use a Maildir by specifying:

mail_location = maildir:~/Maildir

Check the Dovecot documentation if you want to mix Maildir for folders and mbox format for your INBOX.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.