On May 15, 2006, at 1:53 PM, Alex Ressi wrote:
I want to connect to my TextDrive hosted email account using
Net::IMAP but the problem is that the authentication method is
?PLAIN.? I?ve been searching to find a good example of how to
connect to an IMAP mailbox using the PlainAuthenticator, but I
haven?t come up with anything.
That’s because there isn’t one.
Can anyone provide a code example of how to connect to an IMAP
mailbox using the ?PLAIN? authentication method?
I wrote an implementation for IMAPCleanse, but haven’t yet submitted
a patch to ruby-core because it should only work on SSL sockets.
Here it is:
RFC 2595 PLAIN Authenticator for Net::IMAP. Only for use with SSL
From RFC 2595 Section 6. PLAIN SASL Authentication
The mechanism consists of a single message from the client to the
server. The client sends the authorization identity (identity to
login as), followed by a US-ASCII NUL character, followed by the
authentication identity (identity whose password will be used),
followed by a US-ASCII NUL character, followed by the clear-text
password. The client may leave the authorization identity
indicate that it is the same as the authentication identity.
return [@user, @user, @password].join("\0")
Creates a new PlainAuthenticator that will authenticate with
def initialize(user, password)
@user = user
@password = password
if defined? OpenSSL then
Net::IMAP.add_authenticator ‘PLAIN’, Net::IMAP::PlainAuthenticator
PS: This is really a question for ruby-talk.
Eric H. - email@example.com - http://blog.segment7.net
This implementation is HODEL-HASH-9600 compliant