locked
Read Gmail emails using Powershell RRS feed

  • Question

  • We want to automate actions  (create Event Log entries) based on emails we receive by email from different management systems from devices in our network

    I've tried this small script, but it lists only the subject, not the body

    # load rss-feed
    $webclient = new-object System.Net.WebClient
    
    # access the rss-feed
    $webclient.Credentials = new-object System.Net.NetworkCredential ("scominbox@domain", "Password")
    
    # download the rss as xml
    [xml]$xml= $webclient.DownloadString("https://mail.google.com/mail/feed/atom")
    
    # display only sender name and message title as custom table
    $format= @{Expression={$_.title};Label="Title"},@{Expression={$_.author.name};Label="Author"}
    
    # display the table
    $xml.feed.entry | format-table $format
    

    How can I read the emails with Powershell?


    Freddy

    Wednesday, February 22, 2017 3:38 PM

All replies

  • What email client are you using?  What mail serrver?

    \_(ツ)_/

    Wednesday, February 22, 2017 4:56 PM
  • Email client? No specific client. The script works with Gmail's own RSS feed, I just want more information I'm not getting the way the script is written right now

    Mail server? Again... This is Gmail

    Is there another way to read email with Powershell????


    Freddy

    Thursday, February 23, 2017 1:26 PM
  • If the data isn't in the RSS feed then it can't be had.  Post your issue in the google developers forum and use the web service to retrieve mail.


    \_(ツ)_/

    Thursday, February 23, 2017 3:29 PM