REA_ANDREW
asked on
POP3 Authorization
Hi,
I have been working on this code which will access a pop3 server and thus retrieve the emails. I have been working around a tutorial. I can connect to the server,
it returns +OK
But when I supply the username and password for the account it does not allow me access. I am supplying the correct Information as I can access this email box with Outlook Express with the same username and password.
I type in the pop3 server name and use PORT 110 (POP3) <--------Everything is successful apart from the way I send the username and password.
Anyways here is my code, thank you in advance.
protected void Button1_Click(object sender, EventArgs e)
{
OutPut.InnerHtml = "";
try
{
TcpClient AndyTcpCLient = new TcpClient();
AndyTcpCLient.Connect(txtS erver.Text , Convert.ToInt32(DropDownLi st1.Select edValue));
NetworkStream netStream = AndyTcpCLient.GetStream();
StreamReader strReader = new StreamReader(netStream);
if (AndyTcpCLient.Connected)
{
OutPut.InnerHtml += "You have Connected <br />";
OutPut.InnerHtml += strReader.ReadLine() + "<br />";
byte[] WriteBuffer = new byte[256];
ASCIIEncoding enc = new ASCIIEncoding();
WriteBuffer = enc.GetBytes("USER xxxxxxxx \r\n");
netStream.Write(WriteBuffe r, 0, WriteBuffer.Length);
//OutPut.InnerHtml += strReader.ReadLine()+"<br />";
WriteBuffer = null;
WriteBuffer = enc.GetBytes("PASS xxxxxxxx \r\n");
netStream.Write(WriteBuffe r, 0, WriteBuffer.Length);
OutPut.InnerHtml += strReader.ReadLine() + "<br />";
//WriteBuffer = enc.GetBytes("LIST\r\n");
// netStream.Write(WriteBuffe r, 0, WriteBuffer.Length);
OutPut.InnerHtml += strReader.ReadLine() + "<br />";
}
}
catch (Exception ex)
{
Response.Write(ex.ToString ());
}
}
I have been working on this code which will access a pop3 server and thus retrieve the emails. I have been working around a tutorial. I can connect to the server,
it returns +OK
But when I supply the username and password for the account it does not allow me access. I am supplying the correct Information as I can access this email box with Outlook Express with the same username and password.
I type in the pop3 server name and use PORT 110 (POP3) <--------Everything is successful apart from the way I send the username and password.
Anyways here is my code, thank you in advance.
protected void Button1_Click(object sender, EventArgs e)
{
OutPut.InnerHtml = "";
try
{
TcpClient AndyTcpCLient = new TcpClient();
AndyTcpCLient.Connect(txtS
NetworkStream netStream = AndyTcpCLient.GetStream();
StreamReader strReader = new StreamReader(netStream);
if (AndyTcpCLient.Connected)
{
OutPut.InnerHtml += "You have Connected <br />";
OutPut.InnerHtml += strReader.ReadLine() + "<br />";
byte[] WriteBuffer = new byte[256];
ASCIIEncoding enc = new ASCIIEncoding();
WriteBuffer = enc.GetBytes("USER xxxxxxxx \r\n");
netStream.Write(WriteBuffe
//OutPut.InnerHtml += strReader.ReadLine()+"<br />";
WriteBuffer = null;
WriteBuffer = enc.GetBytes("PASS xxxxxxxx \r\n");
netStream.Write(WriteBuffe
OutPut.InnerHtml += strReader.ReadLine() + "<br />";
//WriteBuffer = enc.GetBytes("LIST\r\n");
// netStream.Write(WriteBuffe
OutPut.InnerHtml += strReader.ReadLine() + "<br />";
}
}
catch (Exception ex)
{
Response.Write(ex.ToString
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
This code looks challenging too, so thanks for that As i am learning C# I want to be in at the Deepend :-) .
Will get back to you with the results. Thanks again
Andrew