# Maildrop troubles

## Beerke

I got the following trouble when i try to use maildrop with the virtual mailhosting guide

```
Mar 20 16:49:50 [maildrop] Invalid user specified.

Mar 20 16:49:50 [postfix/pipe] 95863A8E7B: to=<albert@simenon.nl>, relay=maildrop, delay=1, status=deferred (temporary failure. Command output: /usr/bin/maildrop: Invalid user specified. )
```

Anyone knows wat is causing this. Below is an output of the postfix configuration

```
alias_database = hash:/etc/mail/aliases

alias_maps = mysql:/etc/postfix/mysql-aliases.cf

broken_sasl_auth_clients = yes

command_directory = /usr/sbin

config_directory = /etc/postfix

daemon_directory = /usr/lib/postfix

debug_peer_level = 2

default_destination_concurrency_limit = 10

home_mailbox = .maildir/

local_recipient_maps = $alias_maps $virtual_mailbox_maps unix:passwd.byname

local_transport = local

mail_owner = postfix

mailq_path = /usr/bin/mailq

manpage_directory = /usr/share/man

mydestination = $myhostname, localhost.$mydomain $mydomain

mynetworks = 192.168.0.0/24, 127.0.0.0/8

newaliases_path = /usr/bin/newaliases

queue_directory = /var/spool/postfix

readme_directory = /usr/share/doc/postfix-2.0.11

relocated_maps = mysql:/etc/postfix/mysql-relocated.cf

sample_directory = /etc/postfix/sample

sendmail_path = /usr/sbin/sendmail

setgid_group = postdrop

smtpd_recipient_restrictions = permit_sasl_authenticated,       permit_mynetworks,      reject_unauth_destination

smtpd_sasl_auth_enable = yes

smtpd_sasl_local_domain =

smtpd_sasl_security_options = noanonymous

smtpd_tls_CAfile = /etc/postfix/cacert.pem

smtpd_tls_cert_file = /etc/postfix/newcert.pem

smtpd_tls_key_file = /etc/postfix/newreq.pem

smtpd_tls_loglevel = 3

smtpd_tls_received_header = yes

smtpd_tls_session_cache_timeout = 3600s

smtpd_use_tls = yes

tls_random_source = dev:/dev/urandom

transport_maps = mysql:/etc/postfix/mysql-transport.cf

unknown_local_recipient_reject_code = 450

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

virtual_gid_maps = static:1002

virtual_mailbox_base = /

virtual_mailbox_domains = beerke.nl,    simenon.nl,     simenon.be,     ponderosa.be,   dewitteballon.nl

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

virtual_minimum_uid = 1000

virtual_transport = $mydomain,$transport_maps

virtual_uid_maps = static:1002

```

----------

## Dr_Stein

Is that actually a valid user?  :Razz: 

----------

## Beerke

yes it is a valid user, is there maybe a way to increase the verbosity of maidlrop ?

----------

## Dr_Stein

More verbose logging? Not that I know of, but I only get that error when  Postfix can't find the user in the MySQL tables.

Do you have a "catch-all" address for the domain? 

You can turn up Postfix's logging to see what it's doing. I don't think that maildrop is actually the problem here.

----------

## Beerke

Strangely when i comment the lines below it delivers the mail in the porper virtual user mailbox, but not with maildrop. However when i uncomment these lines it will deliver with maildrop but it says then 'invalid user' as posted above. This makes me think that or the error lies in the mysql-transport.cf file, but i triple checked that already and it is correct. Maybe it is how postfix makes his call to maildrop, but that seems also correct to me. So i am kinda stuck to see what the problem is here. 

```

transport_maps = mysql:/etc/postfix/mysql-transport.cf

virtual_transport = $mydomain,$transport_maps

```

master.cf

```

# ==========================================================================

# service type  private unpriv  chroot  wakeup  maxproc command + args

#               (yes)   (yes)   (yes)   (never) (100)

# ==========================================================================

smtp      inet  n       -       n       -       -       smtpd -v

#smtps    inet  n       -       n       -       -       smtpd

#  -o smtpd_tls_wrappermode=yes -o smtpd_sasl_auth_enable=yes

#submission     inet    n       -       n       -       -       smtpd

#  -o smtpd_enforce_tls=yes -o smtpd_sasl_auth_enable=yes

#628      inet  n       -       n       -       -       qmqpd

pickup    fifo  n       -       n       60      1       pickup

cleanup   unix  n       -       n       -       0       cleanup

qmgr      fifo  n       -       n       300     1       qmgr

#qmgr     fifo  n       -       n       300     1       nqmgr

#tlsmgr   fifo  -       -       n       300     1       tlsmgr

rewrite   unix  -       -       n       -       -       trivial-rewrite

bounce    unix  -       -       n       -       0       bounce

defer     unix  -       -       n       -       0       bounce

flush     unix  n       -       n       1000?   0       flush

proxymap  unix  -       -       n       -       -       proxymap

smtp      unix  -       -       n       -       -       smtp

relay     unix  -       -       n       -       -       smtp

#       -o smtp_helo_timeout=5 -o smtp_connect_timeout=5

showq     unix  n       -       n       -       -       showq

error     unix  -       -       n       -       -       error

local     unix  -       n       n       -       -       local

virtual   unix  -       n       n       -       -       virtual

lmtp      unix  -       -       n       -       -       lmtp

#

# Interfaces to non-Postfix software. Be sure to examine the manual

# pages of the non-Postfix software to find out what options it wants.

#

# maildrop. See the Postfix MAILDROP_README file for details.

#

maildrop  unix  -       n       n       -       -       pipe

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

#

# The Cyrus deliver program has changed incompatibly, multiple times.

#

old-cyrus unix  -       n       n       -       -       pipe

  flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user}

# Cyrus 2.1.5 (Amos Gouaux)

cyrus     unix  -       n       n       -       -       pipe

  user=cyrus argv=/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user}

uucp      unix  -       n       n       -       -       pipe

  flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)

ifmail    unix  -       n       n       -       -       pipe

  flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)

bsmtp     unix  -       n       n       -       -       pipe

  flags=Fq. user=foo argv=/usr/local/sbin/bsmtp -f $sender $nexthop $recipient

```

mysql-transport.cf

```

                                                                                                                                                            

user            = mailsql

password        = ***********

dbname          = mailsql

table           = transport

select_field    = destination

where_field     = domain

hosts           = unix:/var/run/mysqld/mysqld.sock

```

maildroprc

```

# hostname - host name of your ldap server

hostname        localhost

port            3306

socket          /var/run/mysqld/mysqld.sock

database        mailsql

dbuser          mailsql

dbpw            **********

dbtable         users

                                                                                                                                                            

#not used now

#timeout                5

                                                                                                                                                            

# default_uid - default uid (number only) to use incase uidnumber attribute not

# found in users mysql entry

default_uidnumber       1002

                                                                                                                                                            

# default_gid - default gid (number only) to use incase gidnumber attribute not

# found in users ldap entry

default_gidnumber       1002

                                                                                                                                                            

# MySQL Field definitions

#

# This section allows you to specify the actual attributes you

# use in your Mysql record

#

# The example attribute mapping shown below is also the default

# mapping used by maildrop in the case that any are missing

                                                                                                                                                            

# UID_FIELD - MySQL attribute which contains the users name (w or w/o domain)

uid_field               email

                                                                                                                                                            

# UIDNUMBER_FIELD - MySQL attribute which contains the system uid to deliver

# mail as

uidnumber_field         uid

                                                                                                                                                            

# GIDNUMBER_FIELD - MySQL attribute which contains the system gid to deliver

# mail as

gidnumber_field         gid

                                                                                                                                                            

# MAILDIR_FIELD - MySQL attribute which contains the path to the users

# custom maildir

maildir_field           maildir

                                                                                                                                                            

# HOMEDIRECTORY_FIELD - MySQL attribute which contains the path to the users

# home directory

homedirectory_field     homedir

                                                                                                                                                            

# QUOTA_FIELD - MySQL attribute which contains the users quota

quota_field             quota

                                                                                                                                                            

# MYSQL_DEFAULT_STATUS_FIELD - MySQL attribute which could be created in the

# MySQL entry to set whether or not the user is allowed to receive email on

# this box..

#               -- looks unused for now; but must be valid column ! (2001-11-03)

mailstatus_field        postfix

                                                                                                                                                            

# MYSQL_DEFAULT_WHERE_CLAUSE - This is optional !

# It can be set to any fixed string starting with keyword 'AND'.

# It will then be appended to the WHERE clause of our query.

where_clause            ""

```

----------

## Dr_Stein

Tell us more about the "albert@simenon.nl" address...

Is it a virtual address? A local one? 

If you don't have a "one to one" mapping in the MySQL 

IE, albert@simenon.nl will have to map to "albert@simenon.nl" in the MySQL 

| 62 | info@textish.com                 | info@textish.com

Just an example. if you only have a "catch all" address, then you'll get that particular error. It can't find the exact user to map to.

Definately something to look into.  :Smile: 

----------

## Beerke

Below a dump of the tables, strangely the same tables work on the old server but i am migrating all stuff to a new server

the emailadress is a vitual user, all emailadresses are virtual users

 the users table :

```

"1";"albert@simenon.nl";"*******";"A.J.S. Simenon";"1002";"1002";"/home/vmail/users/beerke";"/home/vmail/users/beerke/.maildir/";;"y"

```

virtual table

```

"1";"albert@simenon.nl";"albert@simenon.nl"

"5";"@simenon.nl";"albert@simenon.nl"

```

transport table

```

"1";"simenon.nl";"maildrop:"
```

alias table

```
"1";"root";"albert@simenon.nl"

"2";"postmaster";"albert@simenon.nl"

```

----------

## Beerke

* little bump *

----------

## Beerke

i am still investigating this and still haven't found the solution.

strange is that i can do it on the command-line like this :

```

maildrop -d albert@simenon.nl -V 9 < somemessage

```

however if maildrop is called by postfix it still says invalid user specified[/code]

----------

## Beerke

SOLVED

the following line in postfix/master.cf 

```

maildrop  unix  -       n       n       -       -       pipe

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

```

should be ( look at the $)

```

maildrop  unix  -       n       n       -       -       pipe

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

```

----------

## Dr_Stein

I didn't catch that one. Glad that you got it solved.  :Very Happy: 

The "one to one" mapping caught me before...

----------

