Currently I have a PHP script that connect to a mail server via IMAP and parse new emails to MySQL. credentials to connect to the mail server are stored in MySQL using plain
I use these functions or some variation of them for login. It tends to be pretty secure, as it salts the passwords and hashes them.