imtest seems to be broken for me when doing PLAIN authentication (however doing it manually works fine). Below you can see imtest failing to login followed by the successful manual login attempt. % imtest -t "" -u cyrus -a cyrus -m plain localhost [..] TLS connection established: TLSv1 with cipher DES-CBC3-SHA (168/168 bits) C: C01 CAPABILITY S: * CAPABILITY IMAP4 IMAP4rev1 ACL QUOTA LITERAL+ NAMESPACE UIDPLUS ID NO_ATOMIC_RENAME UNSELECT MULTIAPPEND SORT THREAD=ORDEREDSUBJECT THREAD=REFERENCES IDLE STARTTLS AUTH=PLAIN X-NETSCAPE S: C01 OK Completed in sasl_client_start mech list from server is plain Considering mech plain Best mech so far: PLAIN Plain step #1 Trying to get userid Trying to get authid Trying to get password returning prompt(s) Please enter your password: in sasl_client_start Plain step #1 Trying to get userid Trying to get authid Trying to get password Got username, authid, and password userid=[cyrus] authid=[cyrus] password=[$cyrus] C: A01 AUTHENTICATE PLAIN S: + Plain step #3 Verify we're done stepC: S: A01 NO bad protocol / cancel Authentication failed. generic failure Security strength factor: 0 . AUTHENTICATE PLAIN + Y3lydXMAY3lydXMAJGN5cnVz . OK Success (tls protection) . LOGOUT * BYE LOGOUT received . OK Completed Connection closed. Just for completeness, imtest works fine using the 'login' mechanism and the base64 auth string was generated as follows: % echo -n "cyrus\0cyrus\0\$cyrus" | openssl base64 Y3lydXMAY3lydXMAJGN5cnVz -- Cillian