-
-
Notifications
You must be signed in to change notification settings - Fork 17
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to correctly download attachment #29
Comments
Try to be more specific - what you have, what doesn't work, what you are doing, which protocol. |
According to docs The way to mark messages as read using the IMAP protocol is to set the \Seen flag on the message(s). To do this using MailKit, you will first need to know either the index(es) or the UID(s) of the messages that you would like to set the \Seen flag on. Once you have that information, you will want to call one of the AddFlags() methods on the ImapFolder. For example:
To mark messages as unread, you would remove the \Seen flag, like so:
|
As for your move problem:
|
Hello, I have a problem with these piece of the code: foreach ($email in $Client.data.Inbox){ $resolvedFolder = $Client.data.GetFolder("Junk") } I get an error: Cannot find an overload for "MoveTo" and the argument count: "2". I have seen an example like this with 0 instead of the $email and tried but I didn't move the correct email :( How did you solve this issue? |
Type From the docs:
C#
[Copy](http://www.mimekit.net/docs/html/M_MailKit_Net_Imap_ImapFolder_MoveTo_1.htm#)
public override void MoveTo(
IList<int> indexes,
IMailFolder destination,
CancellationToken cancellationToken = default
)
Parameters
indexes
Type: [System.Collections.Generic.IList](https://docs.microsoft.com/dotnet/api/system.collections.generic.ilist-1)<Int32>
The indexes of the messages to move.
destination
Type: [MailKit.IMailFolder](http://www.mimekit.net/docs/html/T_MailKit_IMailFolder.htm)
The destination folder.
cancellationToken (Optional)
Type: [System.Threading.CancellationToken](https://docs.microsoft.com/dotnet/api/system.threading.cancellationtoken)
The cancellation token You can see that the expectation is either List of INTs (indexes) or list of UIDs in specific format. You probably just need to provide it in proper way |
Thank you for you answer. I have turned the code around like this: #get all emails from inbox #loop through email UID-s and retrieve messages I do get an error where ONE unique email gets like 30 unique UID-s and when I try running GetMessage with these ID-s I get an error like this: Exception calling "GetMessage" with "1" argument(s): "Specified argument was out of the range of valid values. Parameter name: index at MailKit.Net.Imap.ImapFolder.d__226.MoveNext() The email sender and content is the same for all 30 UID-s, which should only bet one UID. Also I get an error but it still works when I run this piece of code: $folderDestination = $Client.data.GetFolder('Junk') An error occurred while enumerating through a collection: The folder is not currently open... |
I am unable to download attachment, and i was not able to found any examples reguarding this topic can anybody help ?
The text was updated successfully, but these errors were encountered: