I copied some code from http://wiki.dovecot.org/PostLoginScripting and made the following bash script "dovecot_postlogin.sh" :
if [ "$USER" = "myuser" ] ; then
printf "* NO [ALERT] The user '$USER' can not login\r\n"
exit 0
fi
exec "$@"
but keep getting
"dovecot: imap-postlogin: Error: /usr/local/bin/dovecot_postlogin.sh: 6: /usr/local/bin/dovecot_postlogin.sh: Syntax error: end of file unexpected (expecting "then")"
in my mail.log.