Gossamer Forum
Home : Products : Gossamer Mail : Discussion :

Search for Forwards

Quote Reply
Search for Forwards
Is there any way to run a search report to let me know who has forwarding turned on???

Mike
Quote Reply
Re: [pcmike] Search for Forwards In reply to
Hi Mike,

I put this code together and it works for me under GMail 2.2.0:

Code:
#!/usr/bin/perl -w
use strict;
use lib '/path/to/gmail/admin';
use GMail qw/:objects/;

#GMail::init('/path/to/gmail/admin');

my $sth = $DB->table('users')->select ( {}, ['email']);
my $users = $sth->fetchall_arrayref;

print $IN->header;
print "<pre>\n";
print "GMail users with forwarding turned on:\n";
print "--------------------------------------\n";

foreach my $user (@$users) {
$USER->load_user($user->[0]); # load the user
-f "$USER->{dir}/.prefs" or next;
print "$user->[0] has forwarding enabled.\n"
if $USER->{opts}->{mailbox}->{forward_email};
}
print "--------------------------------------\n";

I'm not sure how well it will work for you but drop me a note if it doesn't. You will need to edit the use lib '...' and GMail::init(...) lines for your install. Hmm, now that I think about it, you should comment out the GMail::init line for anything under GMail 2.2.0.

~Charlie
Quote Reply
Re: [Chaz] Search for Forwards In reply to
Worked like a charm...

Thanks
Quote Reply
Re: [pcmike] Search for Forwards In reply to
No worries :)

I got your e-mail... Thank you.

~Charlie