Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Mail Clients and Perl

by l3nz (Friar)
on Nov 17, 2003 at 17:26 UTC ( [id://307742]=perlquestion: print w/replies, xml ) Need Help??

l3nz has asked for the wisdom of the Perl Monks concerning the following question:

Back in the days when I was a kid and before the internet for everyone, I used to check my e-mail and discuss things using a BBS and connecting to it as a 'point', i.e. I automatically downloaded a packet of email and echomail, ended the phone call, unpacked the messages, used a program called 'squish' to toss messages to the appropriate areas on my system and then used a message editor like GoldEd to edit end review my email. What was really nice with this setting is that such programs were built for users, i.e. everything was driven by a number of batch files and I could add my homebrew features with a number of small C programs receiving a simple text file in input and modifying it as needed.

You wonder what this has to do with Perl - well, the point is that I'm looking for a mail client that is powerful enough to be scripted in Perl. I want it to launch small Perl scripts after fetching mail or on my command, and I want them to manipulate what was downloaded so that I can play nice tricks with it. I usually use a win32 system. As far as I have seen, neither Eudora nor TheBat nor Pegasus support anything like this. Got any suggestions?

Replies are listed 'Best First'.
Re: Mail Clients and Perl
by Corion (Patriarch) on Nov 17, 2003 at 17:51 UTC

    If you want real, raw scripting power, consider Win32::OLE together with Microsoft Outlook - it's quite some thing, and it is almost fully scriptable.

    Mark Overmeer has written a Tk Perl mailclient, out of which many of his Mail::Box modules came, which will be of much use to you if you decide on embarking on writing your own mail client.

    Personally, I have a Mail::Audit script in my .forward file, which processes all my incoming mail into different folders, which I then read through an IMAP4 client.

    If you want to stay with only one machine and only have POP3 inboxes, I recommend using one of the POP3 client modules to download your mail, and then feed the mails to another Perl script which then sorts them into local storage and munges them to whatever you want. Most mail readers can read the mailbox format or something similar.

    perl -MHTTP::Daemon -MHTTP::Response -MLWP::Simple -e ' ; # The $d = new HTTP::Daemon and fork and getprint $d->url and exit;#spider ($c = $d->accept())->get_request(); $c->send_response( new #in the HTTP::Response(200,$_,$_,qq(Just another Perl hacker\n))); ' # web
Re: Mail Clients and Perl
by markov (Scribe) on Nov 18, 2003 at 08:08 UTC
    You wonder what this has to do with Perl - well, the point is that I'm looking for a mail client that is powerful enough to be scripted in Perl. I want it to launch small Perl scripts after fetching mail or on my command, and I want them to manipulate what was downloaded so that I can play nice tricks with it.

    One thing you must set out of your mind is that e-mail is simple. To anyone: handling e-mail correctly is a complicated tasks!! Nested multiparts, encodings, unicode... even correctly parsing a mail header containing addresses requires a few hundred lines of Perl. Of course, the sloppy job only needs one.

    You have a choice between various sets of modules to script e-mail. For instance the MIME::Entity group, the Mail::Audit stuff, and my MailBox suite. They are all automated e-mail processors, not readers. IMO, the first two are easier to learn, because they are smaller, but leave more of the complications to the programmer. MailBox contains things like read(), forward(), bounce(), build(), rebuild(), and send() in one integrate library.

    Nick Ing-Simmons has made tkmail, which is a mail reader, but I couldn't find it. There is a Mail::Procmail. In the near future, I will release a Mail::Box::Procmail, with a fully Perl-based configuration.

Re: Mail Clients and Perl
by cleverett (Friar) on Nov 17, 2003 at 17:33 UTC
    Take a look at Mail::Audit.
Re: Mail Clients and Perl
by neilwatson (Priest) on Nov 17, 2003 at 20:58 UTC
      Regexes are 1st grade readers compared to Procmail's recipes.

      If things get any worse, I'll have to ask you to stop helping me.

Re: Mail Clients and Perl
by naChoZ (Curate) on Nov 20, 2003 at 18:09 UTC

    Sylpheed-claws can do what you're asking. Custom actions are trivial. It's trivial to make it pipe the message to stdin for your script to receive and suck the output from stdout for the results.

    --
    Diplomacy is the art of saying "Nice doggie" until you can find a rock.
    naChoZ

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://307742]
Approved by allolex
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2024-04-25 17:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found