Đang Thực Hiện

161699 C# POP3 Code Update to SSL

I have a C# app which retrieves emails from a pop3 account, all works good the only change I need is to enable SSL support so it can be used with POP from Gmail. This is the code of the POP3 Class (in a DLL) which is used by my app this is the code used in the app:

[url removed, login to view]

Pop3 pop = new Pop3();

[url removed, login to view](server, username, password);

[url removed, login to view] containing the class:

public class Pop3 : TcpClient

{

// Methods

public void Connect(string server, string username, string password)

{

[url removed, login to view](server, 110);

string str2 = [url removed, login to view]();

if ([url removed, login to view](0, 3) != "+OK")

{

throw new Pop3Exception(str2);

}

string message = "USER " + username + "\r\n";

[url removed, login to view](message);

str2 = [url removed, login to view]();

if ([url removed, login to view](0, 3) != "+OK")

{

throw new Pop3Exception(str2);

}

message = "PASS " + password + "\r\n";

[url removed, login to view](message);

str2 = [url removed, login to view]();

if ([url removed, login to view](0, 3) != "+OK")

{

throw new Pop3Exception(str2);

}

}

public void Delete(Pop3Message rhs)

{

string message = "DELE " + [url removed, login to view] + "\r\n";

[url removed, login to view](message);

string str = [url removed, login to view]();

if ([url removed, login to view](0, 3) != "+OK")

{

throw new Pop3Exception(str);

}

}

public void Disconnect()

{

string message = "QUIT\r\n";

[url removed, login to view](message);

string str = [url removed, login to view]();

if ([url removed, login to view](0, 3) != "+OK")

{

throw new Pop3Exception(str);

}

}

public ArrayList List()

{

ArrayList list = new ArrayList();

string str = "LIST\r\n";

[url removed, login to view](str);

string str2 = [url removed, login to view]();

if ([url removed, login to view](0, 3) != "+OK")

{

throw new Pop3Exception(str2);

}

while (true)

{

str2 = [url removed, login to view]();

if (str2 == ".\r\n")

{

return list;

}

Pop3Message message = new Pop3Message();

char[] separator = new char[] { ' ' };

string[] strArray = [url removed, login to view](separator);

[url removed, login to view] = [url removed, login to view](strArray[0]);

[url removed, login to view] = [url removed, login to view](strArray[1]);

[url removed, login to view] = false;

[url removed, login to view](message);

}

}

private string Response()

{

byte[] buffer2;

ASCIIEncoding encoding = new ASCIIEncoding();

byte[] bytes = new byte[0x400];

NetworkStream stream = [url removed, login to view]();

int index = 0;

do

{

buffer2 = new byte[2];

if ([url removed, login to view](buffer2, 0, 1) != 1)

{

break;

}

bytes[index] = buffer2[0];

index++;

}

while (buffer2[0] != 10);

return [url removed, login to view](bytes, 0, index);

}

public Pop3Message Retrieve(Pop3Message rhs)

{

Pop3Message message = new Pop3Message();

[url removed, login to view] = [url removed, login to view];

[url removed, login to view] = [url removed, login to view];

string str = "RETR " + [url removed, login to view] + "\r\n";

[url removed, login to view](str);

string str2 = [url removed, login to view]();

if ([url removed, login to view](0, 3) != "+OK")

{

throw new Pop3Exception(str2);

}

[url removed, login to view] = true;

while (true)

{

str2 = [url removed, login to view]();

if (str2 == ".\r\n")

{

return message;

}

[url removed, login to view] = [url removed, login to view] + str2;

}

}

private void Write(string message)

{

ASCIIEncoding encoding = new ASCIIEncoding();

byte[] bytes = new byte[0x400];

bytes = [url removed, login to view](message);

[url removed, login to view]().Write(bytes, 0, [url removed, login to view]);

}

}

This should be just a few lines of code to enable correctly the usage of ssl so it can work with Gmail. Only bid if you have experience and you can do it almost instantly.

Good luck

Kỹ năng: .NET, Bất kì công việc gì

Xem thêm: substring c, c substring, string substring, base code, str, ssl, pop goes, c r, c app, byte, enable ssl support, read write update, list code, net ssl, net gmail, server ssl, separator, read exe, change exe, code read, list gmail emails, dll read code, code delete file, ssl connect, pop3 code

Về Bên Thuê:
( 6 nhận xét ) Guadalajara, Mexico

Mã Dự Án: #1907888