Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing C#, how to retrieve list of emails from Gmail server via POP3
    text
    copied!<p>Hy,</p> <p>I have an application that sends mails with Gmail SMTP server (smtp.gmail.com) using SSL.</p> <p>Now I want to read the emails from that account, does anyone have any idea how can I make this programatically in C# and ASP.NET?</p> <p>At this point I'm using this code:</p> <pre><code>TcpClient tcpClient = new TcpClient(); tcpClient.Connect("pop.gmail.com", 587); NetworkStream netStream = tcpClient.GetStream(); System.IO.StreamReader strReader = new System.IO.StreamReader(netStream); Label7.Text = strReader.ReadLine() + "&lt;br /&gt;"; //Label7.Text = "Server connected!"; byte[] WriteBuffer = new byte[1024]; ASCIIEncoding enc = new System.Text.ASCIIEncoding(); WriteBuffer = enc.GetBytes("USER " + TextBox4.Text + "\r\n"); netStream.Write(WriteBuffer, 0, WriteBuffer.Length); Label7.Text += strReader.ReadLine() + "&lt;br /&gt;"; WriteBuffer = enc.GetBytes("PASS " + TextBox5.Text + "\r\n"); netStream.Write(WriteBuffer, 0, WriteBuffer.Length); Label7.Text += strReader.ReadLine() + "&lt;br /&gt;"; WriteBuffer = enc.GetBytes("LIST\r\n"); netStream.Write(WriteBuffer, 0, WriteBuffer.Length); String ListMessage; while (true) { ListMessage = strReader.ReadLine(); if (ListMessage == ".") { break; } else { Label7.Text += ListMessage + "&lt;br /&gt;"; continue; } } WriteBuffer = enc.GetBytes("QUIT\r\n"); netStream.Write(WriteBuffer, 0, WriteBuffer.Length); Label7.Text += strReader.ReadLine() + "&lt;br /&gt;"; </code></pre> <p>And when I debug it it's shows that it's connected but no response in retrieving emails.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload