Forum Moderators: coopster & phranque

Message Too Old, No Replies

perl imap support

         

jackvull

3:31 pm on Aug 30, 2005 (gmt 0)

10+ Year Member



Hi

I'm trying to create a perl script that can run through an inbox and unsubscribe people from an emailing list if their email address is present.

I've started with the following but get an error:
CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are:

Can't locate IMAP/Admin.pm in @INC (@INC contains: C:/Perl/lib C:/Perl/site/lib .) at c:\inetpub\wwwroot\test\a.pl line 3.
BEGIN failed--compilation aborted at c:\inetpub\wwwroot\test\a.pl line 3.

Is there an extension missing. It doesn't make it clear?
Thanks...

#!C:\Perl\bin

use IMAP::Admin;

$imap = IMAP::Admin->new('Server' => 'aserver.net',
'Login' => 'a@a.com',
'Password' => 'password',
'Port' => port# (143 is default),
'Separator' => ".", # default is a period
'CRAM' => 1, # off by default
'SSL' => 1, # off by default
# and any of the SSL_ options from IO::Socket::SSL
);

$err = $imap->create("user.bob");
if ($err!= 0) {
print "$imap->{'Error'}\n";
}
if ($err!= 0) {
print $imap->error;
}
$err = $imap->create("user.bob", "green");
$err = $imap->delete("user.bob");
$err = $imap->h_delete("user.bob");

$err = $imap->subscribe("user.bob");
$err = $imap->unsubscribe("user.bob");

$err = $imap->rename("bboard", "newbboard");

@quota = $imap->get_quotaroot("user.bob");
@quota = $imap->get_quota("user.bob");
$err = $imap->set_quota("user.bob", 10000);

@acl = $imap->get_acl("user.bob");
%acl = $imap->get_acl("user.bob");
$err = $imap->set_acl("user.bob", "admin", "lrswipdca", "joe", "lrs");
$err = $imap->delete_acl("user.bob", "joe", "admin");

@list = $imap->list("user.bob");
@list = $imap->list("user.b*");

$imap->{'Capability'} # this contains the Capabilities reply from the IMAP server

$imap->close; # close open imap connection

#print "Content-type: text/html\r\n\r\n";
#print "<HTML>\n";
#print "<HEAD><TITLE>Hello World!</TITLE></HEAD>\n";
#print "<BODY>\n";
#print "<H2>Hello World!</H2>\n";
#print "</BODY>\n";
#print "</HTML>\n";

ChadSEO

3:54 pm on Aug 30, 2005 (gmt 0)

10+ Year Member



jackvull,

Is there an extension missing. It doesn't make it clear?

Yup, that's exactly what it means. More precisely, it means that either the module is not installed, or it is in a different location, and Perl cannot find it.

Chad

jackvull

4:17 pm on Aug 30, 2005 (gmt 0)

10+ Year Member



DO you know of somewhere that these modules can be downloaded?
I've had a look at a few places no google but there seem to be many different types.
Any advice of a good module to use?

Thanks.

ChadSEO

4:39 pm on Aug 30, 2005 (gmt 0)

10+ Year Member



www.cpan.org is always a good place to start for modules. There's a built-in module to download/compile/install modules that you can call like this:

perl -MCPAN -e 'shell'

I know this works on Linux, I have yet to try it on Windows though. It requires a little setup the first time through, you can pretty much go with the defaults on everything. When you get to the "cpan>" prompt, you could then do "install IMAP::Admin" to install the missing module. Again, never tested this on Windows.

If you happen to be using ActivePerl, I know they have a Perl Package Manager that's included, although they don't have a great selection, from what I recall.

Chad