All
  I am investigating the possibility of using Perl Mail::IMAPClient  to 
transfer mail from a Sun JES mail system to the Courier mail system.

  I have successfully used this method to connect via IMAP to a Sun JES server 
and to a Microsoft Exchange server, and using PROXYAUTH transfer mail from 
the Sun system to Exchange.

  I was hoping to be able to do the same when going from Sun JES to Courier.

  While I am able to connect as a user via  Mail::IMAPClient to Courier I am 
unable to get the PROXYAUTH method to work.  I have tried connecting both as 
"root" and "courier".  If I connect as a user then I can read their mail.

  An obvious question is what user I should connect as?

  Has anyone done this or has anyone any suggestions?  It may simply be that 
this is not possible with Courier.

  Some example code used for connecting to Sun JES (usernames and passwords 
fudged) is below.  As I mention above this works fine if I connect as a real 
user but I do not have all my users passwords to enable this method to work.

  Thanks in advance for any suggestions.

regards
Stephen Meatheringham

------------------------------------------------------------------------------------------------------------------------------------------
#!/usr/bin/perl

use AutoLoader 'AUTOLOAD';
use Mail::IMAPClient;

$imap_timeout = 180;
$imap_buffer_size = 1024;

my $uid = 'user_to_move';
$imap_source = Mail::IMAPClient->new( User=>"admin_user",
                                      Password=>"admin_password",
                                      Server=>"sun_jes_server_name",
                                      Debug=> 0, Debug_fh => *DBGT );

$imap_source->Timeout($imap_timeout);
$imap_source->Buffer($imap_buffer_size);
$imap_source->Peek(1);

List_Folders($uid);
$imap_source->disconnect();

exit;


sub List_Folders
{
  my $uid = shift;
  my @results = $imap_source->PROXYAUTH("$uid");
  print "\nFolders: " . join(", ",$imap_source->folders),".\n";
  foreach $folder ($imap_source->folders) {
      $imap_source->select("$folder");
      print "\nFolder: " . $imap_source->Folder() . "\n";
      List_Msgs($imap_source, $folder, $uid);
    }
  }
}


sub List_Msgs
{
  my ($s, $folder, $uid) = @_;
  my @msgs = $s->search("ALL");

  foreach my $item (@msgs) {
    my $h = $s->parse_headers($item, "Date", "Subject");
    $subject = $h->{'Subject'}[0];
    $date = $h->{'Date'}[0];
    print "  #$item  Date: $date\n    Subject: $subject\n";
  }
}

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Courier-imap mailing list
Courier-imap@lists.sourceforge.net
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-imap

Reply via email to