Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

changes to Get-IMAPMessage to return a filtered object #41

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sannae
Copy link

@sannae sannae commented Mar 15, 2023

Hello! First-time contributor here, please be understanding...馃槃

I found myself using the Get-IMAPMessage cmdlet, but it looked a bit hard to use to find a specific message - which I thought it was its main purpose, given the name.

At the moment Get-IMAPMessage set the $Client.Folder property containing all the messages in the Inbox.
This PR is a proposal to return a list of PSCustomObjects made of the main properties of each message: From, To, Subject, Body, etc.

This way

  • You may save the messages into a variable ($allMessages = Get-IMAPMessage -Client $Client)
  • You may filter them by sender or recipient or anything else (Get-IMAPMessage -Client $Client -From Jones)

Individual or collection of messages may then be piped to any additional cmdlet (e.g. Remove-IMAPMessage as requested by #37) to be further manipulated.

Thank you

@PrzemyslawKlys
Copy link
Member

Thanks for this but few things to address:

  • Where-Object will be very slow on large mailboxes
  • I'm pretty sure IMAP has filtering builtin which we should try to adopt
  • What if someone wants all messages?
  • What about all other properties of a message that you stripped?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants