# "transport maildrop failure" with Postfix

## NotExcessive

I'm trying to use maildrop as a replacement LDA for a mail server using Postfix and MySQL as a virtual user/virtual domain system. Everything up to this point works, but now, trying to use maildrop by changing the lines in /etc/postfix/main.cf:

```
mailbox_command = /usr/bin/maildrop

#virtual_transport = virtual

virtual_transport = maildrop

maildrop_destination_recipient_limit = 1
```

and sending an email to myself from outside, I see the following output in the log files:

```
Aug 20 22:25:51 [postfix/smtpd] mail_addr_find: me@mydomain.net -> me@mydomain.net

Aug 20 22:25:51 [postfix/smtpd] smtpd_check_rewrite: trying: permit_inet_interfaces

Aug 20 22:25:51 [postfix/smtpd] permit_inet_interfaces: nf-out-0910.google.com 64.233.182.191

Aug 20 22:25:51 [postfix/smtpd] before input_transp_cleanup: cleanup flags = enable_header_body_filter enable_automatic_bcc enable_address_mapping

Aug 20 22:25:51 [postfix/smtpd] after input_transp_cleanup: cleanup flags = enable_header_body_filter enable_automatic_bcc enable_address_mapping

Aug 20 22:25:51 [postfix/smtpd] connect to subsystem public/cleanup

Aug 20 22:25:51 [postfix/smtpd] public/cleanup socket: wanted attribute: queue_id

Aug 20 22:25:51 [postfix/smtpd] input attribute name: queue_id

Aug 20 22:25:51 [postfix/smtpd] input attribute value: 243F51B8DFE

Aug 20 22:25:51 [postfix/smtpd] public/cleanup socket: wanted attribute: (list terminator)

Aug 20 22:25:51 [postfix/smtpd] input attribute name: (end)

Aug 20 22:25:51 [postfix/smtpd] send attr flags = 50

Aug 20 22:25:51 [postfix/smtpd] 243F51B8DFE: client=nf-out-0910.google.com[64.233.182.191]

Aug 20 22:25:51 [postfix/smtpd] > nf-out-0910.google.com[64.233.182.191]: 250 Ok

Aug 20 22:25:51 [postfix/smtpd] < nf-out-0910.google.com[64.233.182.191]: DATA

Aug 20 22:25:51 [postfix/smtpd] > nf-out-0910.google.com[64.233.182.191]: 354 End data with <CR><LF>.<CR><LF>

Aug 20 22:25:52 [postfix/smtpd] public/cleanup socket: wanted attribute: status

Aug 20 22:25:52 [postfix/cleanup] 243F51B8DFE: message-id=<a4bae7570608200525x223a2ea3o8061bc122579c961@mail.gmail.com>

Aug 20 22:25:52 [postfix/smtpd] input attribute name: status

Aug 20 22:25:52 [postfix/smtpd] input attribute value: 0

Aug 20 22:25:52 [postfix/smtpd] public/cleanup socket: wanted attribute: reason

Aug 20 22:25:52 [postfix/smtpd] input attribute name: reason

Aug 20 22:25:52 [postfix/smtpd] input attribute value: (end)

Aug 20 22:25:52 [postfix/smtpd] public/cleanup socket: wanted attribute: (list terminator)

Aug 20 22:25:52 [postfix/smtpd] input attribute name: (end)

Aug 20 22:25:52 [postfix/qmgr] 243F51B8DFE: from=<me@gmail.com>, size=1638, nrcpt=1 (queue active)

Aug 20 22:25:52 [postfix/smtpd] > nf-out-0910.google.com[64.233.182.191]: 250 Ok: queued as 243F51B8DFE

Aug 20 22:25:52 [postfix/pipe] fatal: get_service_attr: unknown username: vmail

Aug 20 22:25:53 [postfix/qmgr] warning: premature end-of-input on private/maildrop socket while reading input attribute name

Aug 20 22:25:53 [postfix/qmgr] warning: private/maildrop socket: malformed response

Aug 20 22:25:53 [postfix/master] warning: process /usr/lib/postfix/pipe pid 15572 exit status 1

Aug 20 22:25:53 [postfix/qmgr] warning: transport maildrop failure -- see a previous warning/fatal/panic logfile record for the problem description

Aug 20 22:25:53 [postfix/master] warning: /usr/lib/postfix/pipe: bad command startup -- throttling

Aug 20 22:25:53 [postfix/qmgr] 243F51B8DFE: to=<me@mydomain.net>, relay=none, delay=3, status=deferred (delivery temporarily suspended: unknown mail transport error)

```

Everything seems to go OK until the last 7 or so lines. My base maildir path is /vmail/domains/, and users' maildirs are of the form /vmail/domains/DOMAIN.TLD/USERNAME. Data is stored in MySQL table 'postfix' with the following fields:

```

username    varchar(255)    

password    varchar(255)    

name               varchar(255)    

maildir            varchar(255)    

quota              int(10)    

domain             varchar(255)    

created     datetime    

modified     datetime       

active               tinyint(1)
```

My /etc/courier/authlib/authmysqlrc file is:

```
MYSQL_SERVER      localhost

MYSQL_USERNAME      postfix

MYSQL_PASSWORD      secret

MYSQL_SOCKET      /var/run/mysqld/mysqld.sock

MYSQL_PORT      3306

MYSQL_OPT      0

MYSQL_DATABASE      postfix

MYSQL_USER_TABLE   mailbox

MYSQL_CLEAR_PWFIELD    password

MYSQL_LOGIN_FIELD   username

MYSQL_MAILDIR_FIELD   maildir 

MYSQL_HOME_FIELD   '/vmail/domains' 

MYSQL_GID_FIELD      '5000' 

MYSQL_UID_FIELD      '5000' 
```

and when I test out the authentication of maildrop against the postfix table using the  /etc/courier/authlib/authdaemonrc mechanism, it seems to authenticate OK.

The command line shows

```
mailserver# /usr/bin/maildrop -V 10 -d me@mydomain.net

maildrop: authlib: groupid=5000

maildrop: authlib: userid=5000

maildrop: authlib: logname=me@mydomain.net, home=/vmail/domains, mail=mydomain.net/me/

maildrop: Changing to /vmail/domains

```

and the log file shows:

```
Aug 20 22:27:53 [authdaemond] Authenticated: sysusername=<null>, sysuserid=5000, sysgroupid=5000, homedir=/vmail/domains, address=me@mydomain.net, fullname=<null>, maildir=mydomain.net/me/, quota=<null>, options=<null>

Aug 20 22:27:53 [authdaemond] Authenticated: clearpasswd=plaintextpassword, passwd=<null>
```

So I'm not sure, but it seems to say OK I'll switch my base location to /vmail/domains/ and I know your maildir lives at /mydomain.net/me/ under this tree... and you're authenticated.

I'm not sure if the problem is  /etc/maildrop/maildroprc. This is what I have in it so far (nothing really):

```
#

# File: /etc/maildrop/maildroprc

#

# Global maildrop filter file

#VHOME="/vmail/domains"

#DEFAULT="$HOME/.maildir/"

VERBOSE=9

LOGFILE="/var/log/maildrop.log"
```

Obviously all is not well. I'm curious about the log entry

```
[postfix/pipe] fatal: get_service_attr: unknown username: vmail 
```

 because it's obviously getting the "vmail" bit from my specifying the base directory, but I don't know how that's getting inserted as a user name. Or is it trying to deliver to a user called "vmail"?

BTW my /etc/postfix/master.cf file is untouched and straight out of the box from the original Postfix-2.2.10 install.

So can anyone please tell me where I'm likely to be going wrong?

----------

## sf_alpha

My main.cf use this as  mailbox command

mailbox_command = /usr/bin/maildrop -d "$USER" -f "$SENDER" "$EXTENSION"

works fine for a years

----------

## NotExcessive

I still see 

```
Aug 20 23:28:39 [postfix/qmgr] 5E2A81B8CDF: from=<me@gmail.com>, size=1842, nrcpt=1 (queue active)

Aug 20 23:28:39 [postfix/pipe] fatal: get_service_attr: unknown username: vmail

Aug 20 23:28:40 [postfix/qmgr] warning: premature end-of-input on private/maildrop socket while reading input attribute name

Aug 20 23:28:40 [postfix/qmgr] warning: private/maildrop socket: malformed response

Aug 20 23:28:40 [postfix/qmgr] warning: transport maildrop failure -- see a previous warning/fatal/panic logfile record for the problem description

Aug 20 23:28:40 [postfix/master] warning: process /usr/lib/postfix/pipe pid 15788 exit status 1

Aug 20 23:28:40 [postfix/master] warning: /usr/lib/postfix/pipe: bad command startup -- throttling

Aug 20 23:28:40 [postfix/qmgr] 5E2A81B8CDF: to=<me@mydomain.net>, relay=none, delay=3, status=deferred (delivery temporarily suspended: unknown mail transport error)

```

 :Sad: 

The format of the username field in table "mailbox" in db "postfix" is me@mydomain.net, and the format of the maildir field is /mydomain.net/me. I don't suppose that has anything to do with the mailbox command you gave me, does it?

----------

## sf_alpha

I guess you have this line in master.cf

```

maildrop  unix  -       n       n       -       -       pipe

  flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}

```

I think you forgot to add user 'vmail'

----------

## NotExcessive

Ooops I didn't have that line, so I've added it and restarted everything. Same result:

```
Aug 20 23:48:08 [postfix/smtpd] input attribute name: reason

Aug 20 23:48:08 [postfix/smtpd] input attribute value: (end)

Aug 20 23:48:08 [postfix/smtpd] public/cleanup socket: wanted attribute: (list terminator)

Aug 20 23:48:08 [postfix/smtpd] input attribute name: (end)

Aug 20 23:48:08 [postfix/qmgr] 327071B8DED: from=<me@gmail.com>, size=1848, nrcpt=1 (queue active)

Aug 20 23:48:08 [postfix/smtpd] > nf-out-0910.google.com[64.233.182.185]: 250 Ok: queued as 327071B8DED

Aug 20 23:48:08 [postfix/pipe] fatal: get_service_attr: unknown username: vmail

Aug 20 23:48:09 [postfix/master] warning: process /usr/lib/postfix/pipe pid 16251 exit status 1

Aug 20 23:48:09 [postfix/master] warning: /usr/lib/postfix/pipe: bad command startup -- throttling

Aug 20 23:48:09 [postfix/qmgr] warning: premature end-of-input on private/maildrop socket while reading input attribute name

Aug 20 23:48:09 [postfix/qmgr] warning: private/maildrop socket: malformed response

Aug 20 23:48:09 [postfix/qmgr] warning: transport maildrop failure -- see a previous warning/fatal/panic logfile record for the problem description

Aug 20 23:48:09 [postfix/qmgr] 327071B8DED: to=<me@mydomain.net>, relay=none, delay=3, status=deferred (delivery temporarily suspended: unknown mail transport error)

```

----------

## NotExcessive

I think the problem may lie in the way variables are passed to maildrop from Postfix.

For my setup. where the virtual users have the form of user@mydomain.net in the name field, and their maildirs are /domain.tld/user in the maildir field of the MySQL table, how would I structure the syntax of the mailbox_command in main.cf? Would it still be mailbox_command = /usr/bin/maildrop -d "$USER" -f "$SENDER" "$EXTENSION" ?

And would I still leave this as it is in master.cf:

```

maildrop  unix  -       n       n       -       -       pipe

  flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient} 
```

----------

## magic919

Do you actually have a user called vmail on your system?

----------

## NotExcessive

I just realised that a little while ago. No. (DUH - that's what happens when you go through the How-Tos at four in the morning). I've changed it to user "mail" and it now stuffs things into maildrop, but I now have a different problem in that I can't get things out of maildrop.

I'd like some help on getting this complete - the last (I think) problem for maildrop I've posted here:

https://forums.gentoo.org/viewtopic-t-490988-highlight-.html

----------

