So you need to enter the username and password for it right?
This is already done and show some references or credits, people deserve it. Link i found in the stackoverflow some months before - LINK
Also using this library or this method the chances of play store app suspension is very HIGH. and Im one of the developer who faced it. My app was sending mails from background with users request. It collected username and password (but never manipulated). And ended up in app suspension!!
Now i use GMAIL AUTH for sending mails from background. And this is the preferred method since it never collect the users ID and Password. The user will be prompted to login the gmail in a web interface and if he authorize your app, the app can send mails from background without user intervention then... as simple as that, and a safe and secure way!
Need a light? I grow weed on my staff, too, if you like.