Alex Ressi
2006-May-15 20:54 UTC
[Rails] Getting Net::IMAP to work with PLAIN auth type...
Hi there, I''m new to rails and I''ve been successful tinkering around but am miffed by the process of trying to connect to my mail server to receive email for ActiveMailer parsing. I''m hosted on TextDrive and have read the following article on the RubyonRails wiki: http://wiki.rubyonrails.com/rails/pages/HowToReceiveEmailsWithActionMailer. 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. Can anyone provide a code example of how to connect to an IMAP mailbox using the ''PLAIN'' authentication method? Thanks, -Alex -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060515/52989b6e/attachment.html
Dae San Hwang
2006-May-16 15:23 UTC
[Rails] Getting Net::IMAP to work with PLAIN auth type...
Use the ''login'' method instead of ''authenticate''. On May 16, 2006, at 5:53 AM, Alex Ressi wrote:> Hi there, > > I?m new to rails and I?ve been successful tinkering > around but am miffed by the process of trying to connect to my mail > server to receive email for ActiveMailer parsing. I?m hosted on > TextDrive and have read the following article on the RubyonRails > wiki: http://wiki.rubyonrails.com/rails/pages/ > HowToReceiveEmailsWithActionMailer. > > > > 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. Can anyone provide a code example > of how to connect to an IMAP mailbox using the ?PLAIN? > authentication method? > > > > Thanks, > > -Alex > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/railsDae San Hwang daesan@gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060516/8ea83bdc/attachment.html
Eric Hodel
2006-May-16 18:19 UTC
[Rails] Getting Net::IMAP to work with PLAIN auth type...
On May 16, 2006, at 8:23 AM, Dae San Hwang wrote:> On May 16, 2006, at 5:53 AM, 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. Can anyone provide a code example >> of how to connect to an IMAP mailbox using the ?PLAIN? >> authentication method? > > Use the ''login'' method instead of ''authenticate''.This won''t work if the IMAP server doesn''t support LOGIN. Mine doesn''t. -- Eric Hodel - drbrain@segment7.net - http://blog.segment7.net This implementation is HODEL-HASH-9600 compliant http://trackmap.robotcoop.com
Eric Hodel
2006-May-16 18:24 UTC
[Rails] Getting Net::IMAP to work with PLAIN auth type...
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 (but not # enforced). class Net::IMAP::PlainAuthenticator ## # 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 empty to # indicate that it is the same as the authentication identity. def process(data) return [@user, @user, @password].join("\0") end private ## # Creates a new PlainAuthenticator that will authenticate with +user+ and # +password+. def initialize(user, password) @user = user @password = password end end if defined? OpenSSL then Net::IMAP.add_authenticator ''PLAIN'', Net::IMAP::PlainAuthenticator end PS: This is really a question for ruby-talk. -- Eric Hodel - drbrain@segment7.net - http://blog.segment7.net This implementation is HODEL-HASH-9600 compliant http://trackmap.robotcoop.com
Dae San Hwang
2006-May-16 20:10 UTC
[Rails] Getting Net::IMAP to work with PLAIN auth type...
Eric, So LOGIN and PLAIN authentication are two different things? Why doesn''t PLAIN authentication work then? I thought it was some sort of bug. Which one regular GUI email clients use? cheers, daesan PS: By the way, TxD does support LOGIN. On May 17, 2006, at 3:16 AM, Eric Hodel wrote:> On May 16, 2006, at 8:23 AM, Dae San Hwang wrote: >> On May 16, 2006, at 5:53 AM, 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. Can anyone provide a code >>> example of how to connect to an IMAP mailbox using the ?PLAIN? >>> authentication method? >> >> Use the ''login'' method instead of ''authenticate''. > > This won''t work if the IMAP server doesn''t support LOGIN. Mine > doesn''t. > > -- > Eric Hodel - drbrain@segment7.net - http://blog.segment7.net > This implementation is HODEL-HASH-9600 compliant > > http://trackmap.robotcoop.com > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/railsDae San Hwang daesan@gmail.com
Eric Hodel
2006-May-16 22:40 UTC
[Rails] Getting Net::IMAP to work with PLAIN auth type...
On May 16, 2006, at 1:09 PM, Dae San Hwang wrote:> So LOGIN and PLAIN authentication are two different things?LOGIN sends the user and password as separately. PLAIN sends the user and password in one ASCII NUL separated line (and allows you to say things like "use this users password and get that user''s email")> Why doesn''t PLAIN authentication work then? I thought it was some > sort of bug.Net::IMAP doesn''t have an authenticator for PLAIN. Writing one wasn''t hard.> Which one regular GUI email clients use?Mail.app supports password (probably LOGIN and PLAIN), CRAM-MD5, Kerberos 4/5 and NTLM. I use SSL + PLAIN. -- Eric Hodel - drbrain@segment7.net - http://blog.segment7.net This implementation is HODEL-HASH-9600 compliant http://trackmap.robotcoop.com
Dae San Hwang
2006-May-17 04:41 UTC
[Rails] Getting Net::IMAP to work with PLAIN auth type...
I''ve been using SSL + LOGIN since PLAIN didn''t seem to work. I didn''t realize that the authenticator was not implemented. Thanks Eric! I wouldn''t have figured that out by myself! best, daesan On May 17, 2006, at 7:40 AM, Eric Hodel wrote:> On May 16, 2006, at 1:09 PM, Dae San Hwang wrote: > >> So LOGIN and PLAIN authentication are two different things? > > LOGIN sends the user and password as separately. > > PLAIN sends the user and password in one ASCII NUL separated line > (and allows you to say things like "use this users password and get > that user''s email") > >> Why doesn''t PLAIN authentication work then? I thought it was some >> sort of bug. > > Net::IMAP doesn''t have an authenticator for PLAIN. Writing one > wasn''t hard. > >> Which one regular GUI email clients use? > > Mail.app supports password (probably LOGIN and PLAIN), CRAM-MD5, > Kerberos 4/5 and NTLM. I use SSL + PLAIN. > > -- > Eric Hodel - drbrain@segment7.net - http://blog.segment7.net > This implementation is HODEL-HASH-9600 compliant > > http://trackmap.robotcoop.com > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/railsDae San Hwang daesan@gmail.com