Skip to content
This repository has been archived by the owner on Feb 2, 2019. It is now read-only.

Corrections for Get-Message (-On, -After, Read and Unread) #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Gmail.ps.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ function Get-Message {
}

if ($On) {
$imap += 'ON "' + $(GetRFC2060Date $After) + '"'
$imap += 'ON "' + $(GetRFC2060Date $On) + '"'
}

if ($From) {
Expand All @@ -285,11 +285,11 @@ function Get-Message {
}

if ($After) {
$imap += 'AFTER "' + $(GetRFC2060Date $After) + '"'
$imap += 'SENTSINCE "' + $(GetRFC2060Date $After) + '"'
}

if ($Before) {
$imap += 'BEFORE "' + $(GetRFC2060Date $Before) + '"'
$imap += 'SENTBEFORE "' + $(GetRFC2060Date $Before) + '"'
}

if ($Cc) {
Expand Down Expand Up @@ -331,7 +331,7 @@ function Get-Message {
if ($imap.Length -gt 0) {
$criteria = ($imap -join ') (')
}

if ($xgm.Length -gt 0) {
$gmcr = 'X-GM-RAW "' + ($xgm -join ' ') + '"'
if ($imap.Length -gt 0) {
Expand All @@ -340,8 +340,8 @@ function Get-Message {
$criteria = $gmcr
}
}

$result = $Session.Search('(' + $criteria + ')');
$result = $Session.Search("($criteria)");
$i = 1

foreach ($item in $result) {
Expand Down