Reputation: 1985
I am using the following C# code retrieve the header of messages, but I want to modify it so it can tell me if the message contains any Attachments, however I do not want to load the complete message with attachments
var command = string.Format("FETCH {0} (FLAGS UID BODY[HEADER])", i);
Clean();
SendCommand(command);
var sizeLine = ReadLine();
I've tried the following
This retrieves the complete message or simply don't work, I am also working from the rfc website but can't seem to find the command for it
var command = string.Format("FETCH {0} (FLAGS UID BODY.PEEK[])", i);
var command = string.Format("FETCH {0} (FLAGS UID BODY[])", i);
var command = string.Format("FETCH {0} (FLAGS UID BODY[HEADER,MIME])", i);
var command = string.Format("FETCH {0} (FLAGS UID BODY[MIME])", i);
Upvotes: 0
Views: 3168
Reputation: 9675
The command you're looking for is UID FETCH ... BODYSTRUCTURE
. Once you've seen the response, you may wish to consider using a library to do the parsing for you. There are at least two candidates on C#, MailKit and something called, IIRC, mailsystem.net. Try mailkit first.
Upvotes: 3
Reputation: 1937
Maybe you forgot to put UID before the FETCH command:
string tag = GetTag();
string response = SendCommandGetResponse(tag + "UID FETCH " + uid + " (BODY" +
(seen ? null : ".PEEK") + "[HEADER])", false);
coming from the S22 ImapClient.cs
Upvotes: 0