Turn on XOAUTH2 authentication and fix bug.