# POP can't find .maildir [SOLVED]

## Thingee

Hello all, I've been trying to get POP to work on my mail server for a while and been having no luck.  I've searched the forums for this same problem but it came up with no solution for the setup I have.

I'm running postfix with virtual mailboxes using postgresql.  I've been following this tutorial to achieve this but I'm a little confused on how this whole system works.  It tells me to create the account vmail for all the mailboxes to use as a homedir.  The mail dir is ".maildir" and it appears POP is having trouble going to that directory as reported by /var/log/messages

```

Jul 27 22:30:02 eagle pop3d: Connection, ip=[71.104.20.230]

Jul 27 22:30:16 eagle pop3d: chdir .maildir: No such file or directory

```

I've tried just creating the directory /home/vmail/.maildir, but when I logged in via POP I got this in the logs...

```

Jul 27 22:45:27 eagle pop3d: LOGIN, user=mike@example.com, ip=[71.104.20.230]

Jul 27 22:45:27 eagle pop3d: scancur opendir("cur"): No such file or directory

```

The tutorial never mentions how .maildir is created.  So my question is how do I set that up so POP can find it.  Thanks everyone!

Here is main.cf...

```

eagle ~ # postconf -n

alias_database = hash:/etc/mail/aliases

alias_maps = hash:/etc/mail/aliases

broken_sasl_auth_clients = yes

command_directory = /usr/sbin

config_directory = /etc/postfix

daemon_directory = /usr/lib/postfix

default_destination_concurrency_limit = 2

home_mailbox = .maildir/

html_directory = /usr/share/doc/postfix-2.3.0/html

local_destination_concurrency_limit = 2

mail_owner = postfix

mailq_path = /usr/bin/mailq

manpage_directory = /usr/share/man

mydomain = example.com

myhostname = eagle.example.com

mynetworks_style = host

myorigin = $mydomain

newaliases_path = /usr/bin/newaliases

queue_directory = /var/spool/postfix

readme_directory = /usr/share/doc/postfix-2.3.0/readme

sample_directory = /etc/postfix

sendmail_path = /usr/sbin/sendmail

setgid_group = postdrop

smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,check_relay_domains

smtpd_sasl_auth_enable = yes

smtpd_sasl_local_domain = $myhostname

smtpd_sasl_security_options = noanonymous

unknown_local_recipient_reject_code = 550

virtual_alias_maps = pgsql:/etc/postfix/pgsql/pgsql-virtual.cf

virtual_gid_maps = pgsql:/etc/postfix/pgsql/pgsql-virtual-gid.cf

virtual_mailbox_base = /home/vmail

virtual_mailbox_domains = pgsql:/etc/postfix/pgsql/pgsql-virtual-domains.cf

virtual_mailbox_maps = pgsql:/etc/postfix/pgsql/pgsql-virtual-maps.cf

virtual_uid_maps = pgsql:/etc/postfix/pgsql/pgsql-virtual-uid.cf

```

Last edited by Thingee on Sat Jul 29, 2006 10:03 am; edited 4 times in total

----------

## magic919

If you send a test message via Postfix then (if it's all working) Postfix will ensure the appropriate .maildir is created and should deliver the message there.

The .maildir you created will not work.  I think the format is /home/vmail/example.com/username/.maildir where email address is username@example.com.  The system parses the email address to get the username.

----------

## Thingee

Hey thanks for the reply.  Sent an email to the server and still no .maildir.  This is what the system log says when I send a email to the server from my gmail account.

```

Jul 28 10:38:44 eagle postfix/qmgr[2007]: 97A7A830230: from=<thingee@gmail.com>, size=1695, nrcpt=1 (queue active)

Jul 28 10:38:44 eagle postfix/qmgr[2007]: 69465830228: from=<thingee@gmail.com>, size=1685, nrcpt=1 (queue active)

Jul 28 10:38:44 eagle postfix/qmgr[2007]: 78DF1830225: from=<thingee@gmail.com>, size=1694, nrcpt=1 (queue active)

Jul 28 10:38:44 eagle postfix/qmgr[2007]: 26A3D83022F: from=<thingee@gmail.com>, size=1722, nrcpt=1 (queue active)

Jul 28 10:38:44 eagle postfix/qmgr[2007]: EEBFA83021B: from=<thingee@gmail.com>, size=1693, nrcpt=1 (queue active)

Jul 28 10:38:44 eagle postfix/virtual[2027]: fatal: gethostbyname("eagle") does not resolve as a fully qualified domain name.

Jul 28 10:38:44 eagle postfix/virtual[2026]: fatal: gethostbyname("eagle") does not resolve as a fully qualified domain name.

Jul 28 10:38:45 eagle postfix/qmgr[2007]: warning: premature end-of-input on private/virtual socket while reading input attribute name

Jul 28 10:38:45 eagle postfix/qmgr[2007]: warning: private/virtual socket: malformed response

Jul 28 10:38:45 eagle postfix/qmgr[2007]: warning: transport virtual failure -- see a previous warning/fatal/panic logfile record for the problem description

Jul 28 10:38:45 eagle postfix/master[1979]: warning: process /usr/lib/postfix/virtual pid 2027 exit status 1

Jul 28 10:38:45 eagle postfix/master[1979]: warning: /usr/lib/postfix/virtual: bad command startup -- throttling

Jul 28 10:38:45 eagle postfix/master[1979]: warning: process /usr/lib/postfix/virtual pid 2026 exit status 1

Jul 28 10:38:45 eagle postfix/qmgr[2007]: 69465830228: to=<mike@example.com>, relay=none, delay=20917, delays=20916/1.1/0/0, dsn=4.3.0, status=deferred (unknown mail transport error)

Jul 28 10:38:45 eagle postfix/qmgr[2007]: 78DF1830225: to=<mike@example.com>, relay=none, delay=86304, delays=86303/1.1/0/0, dsn=4.3.0, status=deferred (unknown mail transport error)

Jul 28 10:38:45 eagle postfix/qmgr[2007]: 26A3D83022F: to=<mike@example.com>, relay=none, delay=1314, delays=1312/1.2/0/0, dsn=4.3.0, status=deferred (unknown mail transport error)

Jul 28 10:38:45 eagle postfix/qmgr[2007]: EEBFA83021B: to=<mike@example.com>, relay=none, delay=92470, delays=92469/1.2/0/0, dsn=4.3.0, status=deferred (unknown mail transport error)

Jul 28 10:38:45 eagle postfix/qmgr[2007]: warning: premature end-of-input on private/virtual socket while reading input attribute name

Jul 28 10:38:45 eagle postfix/qmgr[2007]: warning: private/virtual socket: malformed response

Jul 28 10:38:45 eagle postfix/qmgr[2007]: warning: transport virtual failure -- see a previous warning/fatal/panic logfile record for the problem description

Jul 28 10:38:45 eagle postfix/qmgr[2007]: 97A7A830230: to=<mike@example.com>, relay=none, delay=1546, delays=1545/1.2/0/0, dsn=4.3.0, status=deferred (unknown mail transport error)

```

I know I set /etc/hosts and /etc/resolv.conf correctly.  Correct me if I'm wrong though...

/etc/resolv.conf

```

nameserver xx.xx.xxx.xxx

nameserver xx.xx.xxx.xxx

xx.xx.xxx.xxx   eagle.example.com localhost

```

/etc/hosts

```

127.0.0.1 localhost

xx.xx.xxx.xxx eagle.example.com

```

I am, however, able to send email out from the server though.  Please let me know why my setup makes it report as not having a fully qualified domain.

----------

## Thingee

::bump::

----------

## magic919

You can either set your hostname correctly - check the wiki - or just set it in main.cf for Postfix.  See what errors you get after that is fixed.

----------

## Thingee

The host name is set on: /etc/hosts /etc/resolv.conf and main.cf.  Example.com is just replacing my actual domain till I can get everything working fine on it.

----------

## Thingee

One problem solved now

added the following below  to /etc/hosts and it now accepts emails and makes the .maildir.

```

127.0.0.1 eagle

```

Now back to my original problem...I still can't login through pop3.

If I try off another machine via telnet the follow happens...

```

telnet www.example.com 110

Trying xx.xx.xxx.xxx...

Connected to example.com.

Escape character is '^]'.

+OK Hello there.

user mike@example.com

+OK Password required.

pass xxxxxxx

-ERR chdir .maildir failed

Connection closed by foreign host.
```

So it is still failing to get to the .maildir directory.  Here is my /etc/courier/authlib/authpgsqlrc file...

```

PGSQL_HOST              localhost

PGSQL_PORT              5432

PGSQL_USERNAME          postfix

#PGSQL_PASSWORD          $password  

PGSQL_DATABASE          postfix

PGSQL_USER_TABLE        mailbox

PGSQL_CRYPT_PWFIELD    password

PGSQL_UID_FIELD         uid

PGSQL_GID_FIELD         gid

PGSQL_LOGIN_FIELD       email

PGSQL_HOME_FIELD        homedir

PGSQL_NAME_FIELD        name

PGSQL_MAILDIR_FIELD     maildir

#PGSQL_AUXOPTIONS_FIELD auxoptions

```

Here is my mailbox row for this user...

```

Mailbox Table

   username:    mike

   email:       mike@example.com

   Password:     $1$.2213700$AOdx3nlEm3dKANLVkAjim0

   Name:   Mike

   uid:      1000

   gid:      1000

   maildir:      example.com/mike

   homedir:      /home/vmail

   Quota:        0

   Domain:       example.com

   Created:      2006-07-27 01:38:56.007952-07

   Modified:     2006-07-27 09:43:48.84935-07

   Active:       true

```

----------

## magic919

 *Thingee wrote:*   

> 
> 
> So it is still failing to get to the .maildir directory.  
> 
> Here is my mailbox row for this user...
> ...

 

From the wiki article you are following.  Spot the difference?  Might be what is causing the problem.  If this fails then increase the debug level as suggested in the wiki.

```

Mailbox Table

   username:    username

   email:       user@example.com

   Password:     $1$.2213700$AOdx3nlEm3dKANLVkAjim0

   Name:   Users Name

   uid:      1000

   gid:      1000

   maildir:      example.com/user/

   homedir:      /home/vmail

   Quota:        0

   Domain:       example.com

   Created:      now()

   Modified:     now()

   Active:       true

```

----------

## Thingee

The increase in debug helped a lot thanks magic919.  The syslog showed that it wasn't getting any result from the maildir field on postgres database.  Here was the problem...

In /etc/courier/authlib/authpgsqlrc I had...

```

<space here> PGSQL_MAILDIR_FIELD     maildir

```

On the top of the file it says..

 *Quote:*   

> 
> 
> # Each line in this file must follow the following format:
> 
> #
> ...

 

So by eliminating that space the syslog showed it getting a result.  However it was still opening the wrong directory.  I then added .maildir to the maildir on the test user's row in maildir field so it example.com/mike/.maildir and that did it.

Thanks for all your help!

----------

## magic919

I thought the lack of a trailing slash on the maildir definition would have been it.

Glad you've got it running in any event.

Tony

----------

## Thingee

Well that needed the full path to .maildir so example.com/mike/.maildir and that fixed my last problem.  Once again thanks a lot for your help!   :Very Happy: 

----------

