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

Hi all!

First of all, i'm a complete perl newbie (for a couple of weeks in this subject...)
So i apologize by advance... :)

When you suscribe to some mailing-lists, you're able, once registred, to give some 'orders' (lol) to a kind of, let's say, bot, which listen in fact to the incoming mails, and process them.
So i wanted to reproduce it with perl 5.6 (red hat 7.0), running an IMAP server... so i decided to download from CPAN, 2 modules (not sure of their exacts names...) IMAP::Client and IMAP::Admin ... My problem is that i can't find within the furnished doc of those modules,
the information that will allow me to manipulate the email-structure (headers, body... and so on)

Can someone provide some information about the functions that could help me to do so (like read_subject(), connect_to_account( account_name)...lol)

Thanx in advance,
PS: i hope that it wasn't too stupid... :)
PPS: ylemerci@welho.com
PPPS: congratulations to the staff. the site looks very nice, soft design but efficient. perfect!

Edit: chipmunk 2001-08-03

Replies are listed 'Best First'.
Re: A perl 'bot' for an imap server...
by tachyon (Chancellor) on Aug 03, 2001 at 14:40 UTC

    For mainipulating email messages check out MIME::Tools which includes MIME::Parser to get any part/s or a message that you want and MIME::Entity which lets you consrtuct multipart messages.

    cheers

    tachyon

    s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

      TX tachyion
      I'll have also a look on those modules.
Re: A perl 'bot' for an imap server...
by trantor (Chaplain) on Aug 03, 2001 at 13:38 UTC

    Err... quite a tough subject for a beginner! Have you checked the Tutorials yet?

    What about a Freshmeat search for finding out similar projects, to study and learn from them?

    -- TMTOWTDI

      he he... :)
      i think that it isn't too difficult... (maybe because i'm a newbie in perl), but i've been in c/c++ for a couple of years now.
      I wish it can help...
      For the tuts, i'ven't checked yet, i'm having a look in a couple of secs

        Being a Perl beginner and not a programmer beginner certainly helps. You'll find many similarities with C and C++ (e.g. syntax elements like braces and semicolons used in a similar fashion), many apparent similarities (e.g. method calls), and something which is completely different (e.g. variables, dynamic scoping) :-)

        I think a mail processor is kind of difficult to begin with because it involves many perlisms at the same time:

        • using modules
        • using regular expressions
        • anonymous storage
        • dealing with files

        and so on...

        There's certainly a more C-ish or C++ish way to write such a processor (we like to say there's more than one way to do it) but being already a programmer you're almost certainly interested in a more perlish approach. I think this can be achieved better by reading docs, books and lots of good code. This way, you'll find that using Net::IMAP is not different than using any other module: first yuo have to use it in your source, then after reading the relevant documentation you'll see that the author has provided a new constructor to create an IMAP connection and so on. Just as an example, most modules' documentation start with a minimal example that show how to use the module.

        Net::IMAP is different because it uses a callback approach and therefore a bare bones example is not so trivial to prepare. That's another reason why I say it's a hard choice to start with :-) Then again, if you know C++ you certainly know what callbacks are, so the difficulty is not in the theory behind it but in the actual Perl implementation of a callback.

        For example, have a look at Net::IMAP::Simple and you'll see an example you can try immediately. You can then use this example and extend it: scanning email messages, matching them against patterns, making your program configurable through switches or configuration files, sharing your effort with us :-)

        -- TMTOWTDI