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

Hi friends, Help me to parse incoming mails through OUTLOOK mail client in windows based system, with specific subject. While parsing the mail I want to extract the following data, 1.sender including Ccs 2.subject 3.body of the mail

Replies are listed 'Best First'.
Re: Mail parser
by ikegami (Patriarch) on Feb 14, 2009 at 03:55 UTC
    Wouldn't it make more sense to get the messages from the server rather than from the client?
      Perhaps he would want the actual mail to be available on the OUTLOOK client and the parsed content at a different place. But I am not too sure on this, if we 'take' the message from server via this parsing application, will it become available on OUTLOOK client(as normal).
      if 'take' is only 'read' then no problem; reading from the server is good idea.
      if 'take' is 'read and remove' then getting from the OUTLOOK client would be a good idea.
      I feel that it depends on mail server and mail client configurations.

      Vivek
      -- In accordance with the prarabdha of each, the One whose function it is to ordain makes each to act. What will not happen will never happen, whatever effort one may put forth. And what will happen will not fail to happen, however much one may seek to prevent it. This is certain. The part of wisdom therefore is to stay quiet.
        • Take and leave unchanged is possible with mail servers.
        • Take and remove is possible with mail servers.
        • Take and change is even possible with some mail servers (Not POP, but IMAP and probably Exchange).
      Perhaps he means to get the data from the local mail file on his computer rather than from the server. If he uses a POP3 server, that (server-side) mail file is likely to be empty or will be emptied regularly by the client.

      CountZero

      A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

      "Wouldn't it make more sense to get the messages from the server rather than from the client?"

      Like ikegami I think it would be easier to get the header information etc from the server.

      From my experience it is usually possible to leave a copy of the email on the server for future download if required.

Re: Mail parser
by ww (Archbishop) on Feb 14, 2009 at 12:11 UTC

    If you were expecting this "code machine" to spit out a finished script, you must have missed the slot to drop in the $$$ (or used a counterfeit coin?).

    Seriously, welcome to the Monastery, but please read the above, and update your question so we can better offer help (and that in no-wise deprecates the observations above).

Re: Mail parser
by n3toy (Hermit) on Feb 16, 2009 at 03:35 UTC
    At the risk of blasphemy, I have done this with some Outlook VBA snippet I found on the web and modified it for my needs. I figured since I was already in Outlook, I could catch an event trigger, read the subject line, and if it meets my requirements, grab things like the sender, subject line, etc. and pass the info to my Perl program to do the real work.