Steve [Dovecot] said the following on 2005-09-14 18:53:
> I'm happily using dovecot as my IMAP server and accessing mails using
> Thunderbird... but I want to use the Net::IMAP facilities in the Ruby
> standard library to write some scripts to automate various
> spam-related tasks & housekeeping.
>
hi Steve,
you may find that perl Mail::Audit does the job for you at source -- as
soon as email is delivered, your .forward can call Mail::Audit directly,
and you can script the output. I've found this more flexible and easier
than procmail's satanic syntax, and better than doing it after the mail
is delivered.
> My Ruby script:
>
> require "net/imap"
> imap = Net::IMAP.new('localhost')
> imap.authenticate('LOGIN','myuser','mypassword')
> # More stuff using imap...
>
> From the documentation LOGIN uses plaintext authentication - which I
> understand is always acceptable for Dovecot when connecting from
> localhost. On the 3rd line I get a "NO response" exception
raised
> (indicating that the IMAP server replied "NO") and the error
message
> "Net::IMAP::NoResponseError: Unsupported authentication
mechanism"
> If I change 'LOGIN' to 'CRAM-MD5' (the other value
supported by
> Net::IMAP) then I get a similar (but not identical) error:
> "Net::IMAP::NoResponseError: Authentication failed: Unsupported
> authentication mechanism"
> If I use anything other than either 'LOGIN' or 'CRAM-MD5' I
get an
> error from the Net::IMAP library saying "Unknown auth type" -
which is
> reasonable.
>
> N.B. I've tried both where 'myuser' and 'mypassword'
are valid - and
> not... this doesn't affect the error messages.
>
> There doesn't seem to be anything of interest in /var/log/messages...
>
> Can anyone tell me what is going wrong, and how to resolve this?
anyway, to your original issue, whats not working? this script works
fine for my dovecot server, from localhost. Can you post your
dovecot.conf, output of ifconfig -A (so we can see whether you have
local or remote connections) and the results from setting
imap_listen = *
auth_verbose = yes
in dovecot.conf.
you may want to enable (& read)
#log_path #info_log_path
as well.
FWIW on my OpenBSD 3.7, I get info like this:
Sep 14 20:03:11 scorch imap-login: Aborted login [10.0.0.50]
in /var/maillog
I recommend to STFW & read these:
http://wiki.dovecot.org/moin.cgi/QuestionsAndAnswers#head-4bf6d2af17ff018327373d128ee25bbd5a86d053
http://wiki.dovecot.org/moin.cgi/QuestionsAndAnswers#head-42ea38790508b748ca584981b9c339fcd0140704
for a few more suggestions.
use Net::IMAP::Simple;
# open a connection to the IMAP server
my $server = new Net::IMAP::Simple( 'imap.host' );
# login
$server->login( 'me', 'password' );
# the list of all folders
@folders = $server->mailboxes();
map { print "$_\n"; } @folders;
# close the connection
$server->quit();
cheers, scorch
--
out of the frying pan and into the fire