some import  configure:
plugin {
  mail_filter = mail-filter %u # %u = username given to the script as first
  mail_filter_out = mail-filter-out %u
}

service mail-filter {
 executable = script /usr/local/bin/mail-filter.sh
 user = dovecot
 unix_listener mail-filter {
   mode = 0600
   user = vmail
 }
}
service mail-filter-out {
 executable = script /usr/local/bin/mail-filter-out.sh
 user = dovecot
 unix_listener mail-filter-out {
   mode = 0600
   user = vmail
 }
}
protocol lda {
    mail_plugins = quota sieve expire autocreate mail_filter
    auth_socket_path = /var/run/dovecot/auth-master

    rejection_subject = Rejected: %s
    lda_mailbox_autocreate = yes
    lda_mailbox_autosubscribe = yes
    sendmail_path = /usr/sbin/sendmail
}
cat mail-filter-out.sh
#!/bin/sh
cat > tempfile
cat  mail-filter.sh
#!/bin/sh

USER=$1
cat > tempfile

Some important Error logs£º
Feb 07 15:49:19 lda(q1@a.com)<53648><rY6oIH8WPV6Q0QAA0J78UA>: Error: Mailbox INBOX: Saving mail: write(/home/a.com/q1/storage/m.1) failed: EOF without input
Feb 07 15:49:19 lda(q1@a.com)<53648><rY6oIH8WPV6Q0QAA0J78UA>: Info: msgid=<77z2kkfmm1-7846bu3tx6@nsmail6.0>: save failed to INBOX: Mailbox INBOX: Saving mail: write(/home/a.com/q1/storage/m.1) failed: EOF without input
Feb 07 15:49:19 lda(q1@a.com)<53648><rY6oIH8WPV6Q0QAA0J78UA>: Debug: auth-master: conn unix:/var/run/dovecot/auth-master (pid=10651,uid=0): Disconnected: Connection closed (fd=11)