Click here to Skip to main content
15,919,245 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
dummy = Encoding.ASCII.GetBytes("$ XLIST \"\" \"*\"  \r\n");
 byte[] dummy ;
   System.Net.Sockets.TcpClient tcpc = new System.Net.Sockets.TcpClient("imap.gmail.com", 993);
            System.Net.Security.SslStream ssl = new System.Net.Security.SslStream(tcpc.GetStream());
ssl.Write(dummy, 0, dummy.Length);
buffer = new byte[2048];
bytes = ssl.Read(buffer, 0, 2048);
ssl.Flush();
 dummy = Encoding.ASCII.GetBytes("$ LOGOUT \r\n");
            ssl.Write(dummy, 0, dummy.Length);


-- this command is not working --i can login into gimap using username and password
but im not able to execute any commands
im getting bad could not parse command -- message from gimap
Posted
Comments
bellpatricia 22-Sep-17 3:14am    
Try using this command: * XLIST (\HasNoChildren \Inbox) "/" "Inbox"
Or perhaps this command: * XLIST (\HasNoChildren \AllMail) "/" "[Gmail]/All Mail"
Last as an FYI, if you're interested in simplifying this task then you should check out this imap client class for c#.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900