It seems like you don't know the internals of the SMTP protocol. In that case, it's a bad idea to try to use the raw mode, when the simple mode is much simpler to handle.
In the list of simple mode methods you can find the method "auth" that will try the authentication methods the server accepts in order of preference (of the server. unless you specify your own order in the "methods" argument). Hope that helps