1.    26 Mar 2008 #1
    akcorr Guest

    Can Powershell parse email?


    Is there a way for powershell to read an inbox and look for a specific string
    in the subject or body?
      My System SpecsSystem Spec

  2.    26 Mar 2008 #2
    Keith Hill [MVP] Guest

    Re: Can Powershell parse email?


    "akcorr" <akcorr@xxxxxx> wrote in message
    news:CE0C6455-6881-4302-9C01-54C5F319D7CC@xxxxxx

    > Is there a way for powershell to read an inbox and look for a specific
    > string
    > in the subject or body?
    If you are using Outlook then you can use Outlook COM Automation. Have a
    look at this KB article:

    http://support.microsoft.com/default.aspx/kb/310244

    That C# code should translate to PowerShell script pretty easily.

    --
    Keith

      My System SpecsSystem Spec

  3.    26 Mar 2008 #3
    Marco Shaw [MVP] Guest

    Re: Can Powershell parse email?


    akcorr wrote:

    > Is there a way for powershell to read an inbox and look for a specific string
    > in the subject or body?
    Now, if you're dealing with an IMAP mailbox, you can also check out
    NetCmdlets:
    http://www.nsoftware.com/powershell

    They have a get-imap cmdlet that can retrieve messages, and then you can
    search through them after...

    There's also a get-pop (or get-pop3 cmdlet). Don't try to use
    PowerShell to read the Inbox from Outlook Express or Live Mail directly
    from the local inbox file! It can't decode it, as far as I know.

    Marco

    --
    Microsoft MVP - Windows PowerShell
    http://www.microsoft.com/mvp

    PowerGadgets MVP
    http://www.powergadgets.com/mvp

    Blog:
    http://marcoshaw.blogspot.com
      My System SpecsSystem Spec

  4.    26 Mar 2008 #4
    Shay Levi Guest

    Re: Can Powershell parse email?



    If your email client is outlook:


    $olFolderInbox = 6
    $outlook = new-object -com outlook.application;
    $ns = $outlook.GetNameSpace("MAPI");
    $inbox = $ns.GetDefaultFolder($olFolderInbox)


    $inbox.items | foreach {
    if($_.subject -match "something") {...}
    if($_.body -match "something") {...}
    }



    -----
    Shay Levi
    $cript Fanatic
    http://scriptolog.blogspot.com

    > Is there a way for powershell to read an inbox and look for a specific
    > string in the subject or body?
    >

      My System SpecsSystem Spec

  5.    26 Mar 2008 #5
    kelly goff Guest

    Re: Can Powershell parse email?


    akcorr wrote:

    > Is there a way for powershell to read an inbox and look for a specific string
    > in the subject or body?
    Yes, it can. But how you do it depends on whether you are running the
    script on the server or a client.

    Which do you need?

    Kelly Goff
      My System SpecsSystem Spec


Similar Threads
Thread Forum
XML parse issue
Hi, I have the following XML and I like to grab the node that is in 'List2' and mobilenum=416-222-5435 I have tried the following, XmlNode...
.NET General
Here is a PowerShell script to parse nmap XML output files.
Hello: Here's a simple script to parse the XML output files produced by the nmap port scanner: ...
PowerShell
MSXML 4.0 SP2 Parse and SDK
Hello everyone, While going through the Programs & Features, I saw the above listed. I have no idea what it is. Does anyone recognize it ? I am...
Vista performance & maintenance
How Powershell parse HTMLDocument?
$htmlDoc= New-Object -com "HTMLFILE" $page = "<html><body>this is a test</body></html>" $htmlDoc.write($page) $htmlDoc.close but get Type...
PowerShell
Parse XML files from Powershell?
Say I have an xml file like the one below: <root> <tag id="1"/> <tag id="2"/> <tag id="3"/> <tag id="4"/> <tag id="5"/> </root>
PowerShell
Using Parse-TextObject
Hello All: I'm very much a newbie to Powshell -- just figuring things out as I go along (I'm a c# developer, just working in time to learn...
PowerShell
Parse hyperlinks
Hi, I would like to render a text on a form, but make the http links active. I know how to find them with Regex, but I have no idea how to make...
Avalon

Our Sites
  • Ten Forums
  • Eight Forums
  • Seven Forums
  • PC Help Forum
  • Help Me Bake
  • Site Links
  • Contact Us
  • Privacy and Cookies
  • About Us
    Windows Vista Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

    Designer Media Ltd
    All times are GMT -5. The time now is 17:27.
    .