socket_write("AUTH PLAIN " . encode_base64(join("\0", $auth->{user}, $auth->{user}, $auth->{password}), $CRLF) ) || return fail("send AUTH PLAIN failed (lost connection?)"); socket_read() || return fail("AUTH PLAIN failed: $server_reply");