Mailbox Strainer

Karamba & Superkaramba

Source (link to git-repo or to original if based on someone elses unmodified work): Add the source-code for this project on opencode.net

0
5 .0
Description:

This is a Superkaramba widget that examines an arbitrary number of IMAP mailboxes, POP3 mailboxes and local mail folders for new messages. For the latest new messages, the content of a specified header is displayed on the screen. When new messages arrive, Mailbox Strainer emits a notification via KNotify.

You may have serveral instances running such that each one checks its own collection of mailboxes. SpamAssassin may be invoked to detect spam, or message headers modified by external spam checkers can be evaluated. It is also possible to make SpamAssassin learn from specified IMAP or local folders.
Configuration can be done through a graphical interface or manually via a configuration file (an annotated configuration file is supplied).

Mailbox Strainer is written in Perl. Depending on the features you want to use, a number of Perl modules must be installed. In particular, PerlQt will be needed for the configuration dialog. All modules can be found at http://www.cpan.org , consider using the CPAN shell (perl -MCPAN -e shell) for this will automatically resolve dependencies. To find out which modules are missing on your system, invoke module-test.pl . (Hopefully I didn't forget any of them, it has become quite a number.)

The local mail capabilities are those of the Email::Folder::* modules, so they should be able to handle mbox and maildir. Currently, using the spam detection with local mbox folders is _strongly_ discouraged! It is likely to destroy your Emails, see http://www.nntp.perl.org/group/perl.pep/68 for the reason. (A possible workaround is presented in http://www.nntp.perl.org/group/perl.pep/72.) So spam checking is currently disabled for local mailboxes. You can enable it by changing lines 975, 998 and 1081 of perl/mailbox-strainer.pl. Remove "0 &&" from each of those lines.

A few words about password storage: The configuration dialog stores encrypted passwords (of length at least 8) in the configuration file. This is meant as a protection against accidentally displaying the configuration file, but nothing else. Consider this as a parody on proper encryption, even the 'secret' key can be found in the perl scripts.
Last changelog:

14 years ago

v.91 - The Perl DCOP module has changed recently. I decided to drop the module and use a system call instead.
v.9 - As proposed by alex77s, a sound can be played in case of recent messages. This is done via knotify.
- widget may be hidden unless there are unread messages. (It's in the third screenshot, you see?)

N7DR

14 years ago

I thought that this was going to be exactly what I wanted. But it doesn't work at all here :-(

I created a mailbox-streamer.cfg file, and checked that it was actually being used by changing some innocuous things (like the background image) and reloading the theme to make sure that indeed my changes were reflected in what I see on screen.

So I know that the config file is being read OK.

But I NEVER see any mail, even though I know that there are several e-mails waiting on the POP3 server.

Report

C

quark

14 years ago

You can try and invoke the Perl script manually to see what's wrong. Open a console, cd to mailbox-strainer/perl and try the following command:
"mailbox-strainer.pl ../mailbox-strainer.cfg"
(A single line, mailbox-strainer.pl is the command with the configuration file as an argument.)
There might also be error messages if Superkaramba itself is run from a console.

If this doesn't help, let's try to work it out via email. I'm glad to get some response.

Report

N7DR

14 years ago

[H:perl] mailbox-strainer.pl ../mailbox-strainer.cfg
Can't locate Config/General.pm in @INC (@INC contains: /usr/lib/perl5/5.8.7/x86_64-linux /usr/lib/perl5/5.8.7 /usr/lib/perl5/site_perl/5.8.7/x86_64-linux /usr/lib/perl5/site_perl/5.8.7 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.7/x86_64-linux /usr/lib/perl5/vendor_perl/5.8.7 /usr/lib/perl5/vendor_perl .) at ./mailbox-strainer.pl line 35.
BEGIN failed--compilation aborted at ./mailbox-strainer.pl line 35.
[H:perl]

I'll also send this to your e-mail address, so you can respond whichever way you prefer.

Report

C

quark

14 years ago

It complains about a missing Perl module (Config::General). As explained in the README, you'll find a script named module-test.pl in the installation directory that will tell you which modules are missing.
Config::General probably won't be the only one. You can get all of them from www.cpan.org, but installing each one manually, including its dependencies, will prove cumbersome. So I advise you to try "perl -MCPAN -e shell". If it works, you'll be able to install a module from within that shell simply by typing "install NAME", as in "install Config::General".

Sorry for the inconvenience, but those modules really are necessary.

Report

C

quark

14 years ago

As mentioned above, I reinstalled the DCOP module. Installation indeed went fine, but I had to realize that the theme was broken afterwards. So I dropped that module and uploaded a new version of the theme that uses a system call instead.

Report

C

quark

14 years ago

Did you invoke "install DCOP" from within the CPAN shell? I'm only wondering because of the "$" in "$ install DCOP", it looks like an ordinary shell prompt. And I just tried an "install DCOP" which worked fine.

Secondly, you may run the shell as root or as an ordinary user at your choice, but it will require root privileges to install the modules after the (automatic) build process. If privileges are missing, it will complain and tell you about a config option that has to be changed. I don't remember that option, and I always run the shell as root, anyway.

By the way, I think it is good practice to do a "clean PACKAGE-NAME" after an installation of PACKAGE-NAME has failed (for example because of missing privileges), otherwise I ran into minor problems sometimes.

Finally, the script "module-test.pl" uses the Perl command "use Qt" to detect the presence of PerlQt, which is the canonical way of loading a module. If it doesn't work, I'd say there must be something wrong with the installation. But again, you can install it via the CPAN shell using "install Qt".

Report

C

quark

14 years ago

I'm afraid that it IS in fact an ordinary shell, the CPAN shell might not be working at all. The prompt I get after "perl -MCPAN -e shell" is "cpan>". Can you use ordinary shell commands at that point? You can't do that in the CPAN shell, and the command "h" should display some help text.

Report

N7DR

14 years ago

I'm not sure what you mean by "the CPAN shell". I executed:

perl -MCPAN -e shell

The last few lines of output were...

-----

You have no /home/n7dr/.cpan/sources/MIRRORED.BY
I'm trying to fetch one
CPAN: LWP::UserAgent loaded ok
Fetching with LWP:
ftp://ftp.perl.org/pub/CPAN/MIRRORED.BY
Fetching with LWP:
ftp://ftp.perl.org/pub/CPAN/MIRRORED.BY.gz

-----

Then I got what looked like an ordinary shell prompt, and I executed "install DCOP".

Report

N7DR

14 years ago

I'm not sure what you mean by "the CPAN shell". I executed:

perl -MCPAN -e shell

The last few lines of output were...

-----

You have no /home/n7dr/.cpan/sources/MIRRORED.BY
I'm trying to fetch one
CPAN: LWP::UserAgent loaded ok
Fetching with LWP:
ftp://ftp.perl.org/pub/CPAN/MIRRORED.BY
Fetching with LWP:
ftp://ftp.perl.org/pub/CPAN/MIRRORED.BY.gz

-----

Then I got what looked like an ordinary shell prompt, and I executed "install DCOP".

Report

N7DR

14 years ago

FYI:

It says I need PerlQt (to access the graphical configuration stuff) -- but PerlQt is installed (via urpmi from my distro). So I wonder if there's a problem with the part of module-test.pl that detects PerlQt.

Report

N7DR

14 years ago

OK; there's a ton of modules I need to add. Should I execute "perl -MCPAN -e shell" or as an ordinary user?

Report

N7DR

14 years ago

That should be: "as root or as an ordinary user"?

I tried as an ordinary user, and when it had all finished, I tried "install DCOP", and got the following:

$ install DCOP
install: too few arguments
Try `install --help' for more information.

So presumably I need to run this stuff as root -- but I don't want to run as root unless you tell me I have to.

I added the Time and Config modules from my distro, but the distro doesn't contain DCOP (mandatory) or some of the necessary optional modules.

Report

alex77s

14 years ago

I've modified the widgetClicked code.

def widgetClicked(widget, x, y, button):
if ( button == 1 or button == 2):
click_check = 0
launch = ''
configuration = open(str(karamba.readConfigEntry(widget,"configuration_file")) )
line = configuration.readline()
while line:
if re.search( r'^\s*click_check\s*(1|true|on)',line):
click_check = 1
match = re.search( r'^\s*click_launch\s*(.*)',line)
if match:
launch = match.groups()[-1]
line = configuration.readline()
configuration.close()
if (not click_check and launch and button == 1) or (click_check and launch and button == 2):
program = os.popen( launch + '&')
program.close()
else:
if (click_check and button == 1) or (not click_check and launch and button == 2):
widgetUpdated( widget)

(Damn! The site remove all the spaces in the code. If you need, I send it by email.)

Whit this modifies, if in the config file, the click_launch and the click_check are enabled, and you click button 1 (left button) the script start to check new mails, or if you click button 2 (middle button) start your mail client.
If only one of click_check or click_launch is enable, the script run in usual way.

Report

C

quark

14 years ago

I don't want this defenceless little widget to be cluttered up with clickable areas or icons. Note that looking for new mail is accessible via the update function anyway. In future versions, I'll simply make it check for new messages whenever button 2 is clicked, this certainly won't do any harm.

Report

alex77s

14 years ago

Another way to do something like this, is to set an area of the theme (an icon?) where if you click, it start the mail client, while if you click in any other point it check new mail (or it check new mail if you click on icon, and start mail client on other points).

Report

alex77s

14 years ago

I've added this line in mailbox-strainer.pl at line 221

system('play -v 0.1 /opt/kde3/share/sounds/KDE_Notify.wav');

to play a notify when I receive a new mail.

It's an idea for the future versions of this theme.

Report

C

quark

14 years ago

Thanks for your comments. This seems to be a good idea, there'll probably be some sound facilities in the future. But it will take some more effort, as the idea of this theme is not to open the email client whenever there is a single new message, but rather to collect the new messages for a while. With your solution, if there are any unread messages, there will be a sound every three minutes. So some logging needs to be done to see if one of the messages actually only just arrived.
I'll have to think about this, and I also think that sound should be configurable through the Control Centre, I don't know yet how that may be accomplished.

Report

seraphyn

15 years ago

Will use it, but it won't work under Debian/Stable.
The Configurator make problems with adding some boxes to the mailbox Strainer.

Hope i will find the Bug and give it 2 u for fixing it.

Greetz

Chris

Report

persuader

15 years ago

It does not work on under Mndricva 2006 also, I receive the following error:

This Perl hasn't been configured and built properly for the threads
module to work. (The 'useithreads' configuration option hasn't been used.)

Having threads support requires all of Perl and all of the XS modules in
the Perl installation to be rebuilt, it is not just a question of adding
the threads module. (In other words, threaded and non-threaded Perls
are binary incompatible.)

If you want to the use the threads module, please contact the people
who built your Perl.

Cannot continue, aborting.

Thanks

Report

C

quark

15 years ago

Thanks for your feedback. I can't do anything about your Perl installation not supporting threads. But it does not seem to be very difficult to check for thread support in the script, so I updated the theme to use threads only if available. The non-threaded part works fine here, only I couldn't really test the detection (for the obvious reason). Let me know if it doesn't work.

Report

C

quark

15 years ago

Try invoking
>strainer_configuration.pl ../mailbox-strainer.cfg
from the console with mailbox-strainer/perl as current directory. You will hopefully receive some useful error message.

Report

14 years ago

v.91 - The Perl DCOP module has changed recently. I decided to drop the module and use a system call instead.
v.9 - As proposed by alex77s, a sound can be played in case of recent messages. This is done via knotify.
- widget may be hidden unless there are unread messages. (It's in the third screenshot, you see?)

12345678910
product-maker Base: 4 x 5.0 Ratings
Be the first to comment
File (click to download) Version Description Downloads Date Filesize DL OCS-Install MD5SUM
*Needs pling-store or ocs-url to install things
Pling
0 Affiliates
Details
license
version
0.91
updated Feb 10 2006
added Sep 21 2005
downloads 24h
0
mediaviews 24h 0
pageviews 24h 0