Re: Deleting unused or dormant mail accounts.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>>>>> "BG" == Bron Gondwana <brong@xxxxxxxxxxx> writes:

BG> yes, it should work with 2.4.

Good news.

Since folks may not know much about this, here's some detail.

I've been using this little Perl script to talk to the fud server for so
long that I've no recollection of where it came from.  It's only 53
lines, so I'll just include it.  And of course you have to add the
following to cyrus.conf:

  fud           cmd="fud" listen="fud" proto="udp" prefork=1 maxchild=10

and give the proper (weird) permission so that fud actually works:

  sam user/* anonymous 0

The script follows.  Output looks like this:

> fud-client tibbs
|tibbs|Inbox|0|1315866483|1315866228|
user: tibbs
mbox: Inbox
Number of Recent: 0
Last read: Mon Sep 12 17:28:03 2011
Last arrived: Mon Sep 12 17:23:48 2011

but of course you could hack it up to do whatever you wanted.

 - J<

#!/usr/bin/perl -w

# perl "port" of contrib/fud-client.c that comes with the Cyrus IMAP
# distribution (http://asg.web.cmu.edu/)
# Written by Jason Englander <jason@xxxxxxxxxxxxx>
#
# Released under the GNU GPL.  See http://www.gnu.org/copyleft/gpl.html
# for more information.
#
# 0.1 - July 3, 2002
#       [jme] - Initial release

use Socket;
use strict;

my ($hisiaddr, $hispaddr, $iaddr, $paddr, $port, $proto, $resp);

my $server = 'your.imap.server.here';
my $user = $ARGV[0];
my $mailbox = $ARGV[1] || 'Inbox';

die "\nUsage: $0 user mailbox\n\n" if ! $server || ! $user || ! $mailbox;
die "\nUsage: $0 server user mailbox\n\n" if ! $server || ! $user || ! $mailbox;

$proto = getprotobyname('udp');
$port = getservbyname('fud', 'udp');

socket(SOCKET, PF_INET, SOCK_DGRAM, $proto)   || die "socket: $!";

$| = 1;
$hisiaddr = inet_aton($server) || die "unknown host";
$hispaddr = sockaddr_in($port, $hisiaddr);
defined(send(SOCKET, "$user|$mailbox", 0, $hispaddr)) || die "send $server: $!";

recv(SOCKET, $resp, 512, 0) || die "recv: $!";
close(SOCKET);
my $resp_str = unpack('A*',$resp);
print "|$resp_str|\n";
if ("$resp_str" eq "UNKNOWN") {
       printf "Server did not recognize mailbox %s\n", $mailbox;
}
elsif ("$resp_str" eq "PERMDENY") {
       printf "Permission denied attempting get mailbox info for %s\n", $mailbox;
}
else {
  my ($uname,$mbox,$numrecent,$lread,$lappend) = split('\|',$resp_str);
  printf "user: %s\nmbox: %s\nNumber of Recent: %d\n", $uname, $mbox, $numrecent;
  $lread = localtime($lread);
  printf "Last read: %s\n", $lread;
  $lappend = localtime($lappend);
  printf "Last arrived: %s\n", $lappend;
}
----
Cyrus Home Page: http://www.cyrusimap.org/
List Archives/Info: http://lists.andrew.cmu.edu/pipermail/info-cyrus/


[Index of Archives]     [Cyrus SASL]     [Squirrel Mail]     [Asterisk PBX]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [KDE]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux