Read Gmail emails using Powershell

7,607

How can I read Gmail using PowerShell

You can try Gmail.ps:

A PowerShell module for managing your Gmail, with all the tools you'll need. Search, read and send emails, archive, mark as read/unread, delete emails, and manage labels

Features

  • Read emails
  • Search emails
  • (Update) emails: label, archive, delete, mark as read/unread/spam, star
  • Manage labels
  • Move between labels/mailboxes
  • Automatic authentication, using the Windows Credential Manager

Source Gmail.ps

Note that I've not tested this and have no connection (pun intended) to the software.

Share:
7,607

Related videos on Youtube

Fredrik L
Author by

Fredrik L

I work with Windows Servers, VmWare and SAN, but have touched other system administration fields in the past. At the moment, I work in a Operation Center in Oslo for a large Norwegian Software company, as a system administrator. Programming is boring. Except scripting for windows... Windows Infrastructure is my field of interest, in addition to networking and security

Updated on September 18, 2022

Comments

  • Fredrik L
    Fredrik L almost 2 years

    We want to automate actions 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?

  • Fredrik L
    Fredrik L over 7 years
    I'll try it and update here how it went
  • danno
    danno over 4 years
    ... sooo... how'd it go?