本文整理汇总了C#中OpenPop.Pop3.Pop3Client.Disconnect方法的典型用法代码示例。如果您正苦于以下问题:C# Pop3Client.Disconnect方法的具体用法?C# Pop3Client.Disconnect怎么用?C# Pop3Client.Disconnect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenPop.Pop3.Pop3Client
的用法示例。
在下文中一共展示了Pop3Client.Disconnect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetAllMessages
//Connect to gmail, get emails and ad it to a MessageList
public static List<OpenPop.Mime.Message> GetAllMessages(string hostname, int port, bool ssl, string username, string password)
{
try
{
Pop3Client client = new Pop3Client();
if (client.Connected)
{
client.Disconnect();
}
client.Connect(hostname, port, ssl);
client.Authenticate(username, password);
int messageCount = client.GetMessageCount();
List<OpenPop.Mime.Message> allMessages = new List<OpenPop.Mime.Message>(messageCount);
for (int i = messageCount; i > messageCount - 5; i--)
{
allMessages.Add(client.GetMessage(i));
}
return allMessages;
}
catch(Exception ex)
{
MessageBox.Show("You have written username or password wrong or something else has happened! Program will not keep going, please open it again, thank you : " + ex.Message);
Thread.CurrentThread.Abort();
//EmailClient.
}
return null;
}
示例2: DownloadMailsAndPushToIssueTracker
private static void DownloadMailsAndPushToIssueTracker()
{
var host = Settings.Get("Pop3Host", "");
var port = Settings.Get("Pop3Port", 110);
var useSsl = Settings.Get("Pop3UseSsl", false);
var username = Settings.Get("Pop3Username", "");
var password = Settings.Get("Pop3Password", "");
if (host.IsNoE())
{
Console.WriteLine("\tNo Pop3Host specified.");
LogOwnError(new ApplicationException("No Pop3Host specified."));
return;
}
try
{
Console.WriteLine("\tConnecting to POP3 server {0}:{1} ({4}) using {2} / {3} ...", host, port, username, password, useSsl ? "SSL" : "no SSL");
using (var pop3Client = new Pop3Client())
{
pop3Client.Connect(host, port, useSsl);
if (username.HasValue())
pop3Client.Authenticate(username, password);
Console.WriteLine("\tFetching message count ...");
var messageCount = pop3Client.GetMessageCount();
for (var i = 1; i <= messageCount; i++)
{
try
{
Console.WriteLine("\tFetching message {0} / {1} ...", i, messageCount);
var message = pop3Client.GetMessage(i);
if (PushToIssueTracker(message))
pop3Client.DeleteMessage(i);
}
catch (Exception ex)
{
Console.WriteLine("\tUnable to fetch or push message: " + ex);
LogOwnError(new ApplicationException("Unable to fetch or push message: " + ex.Message, ex));
}
}
pop3Client.Disconnect();
}
}
catch (Exception ex)
{
Console.WriteLine("\tUnable to download mails: " + ex);
LogOwnError(new ApplicationException("Unable to download mails: " + ex.Message, ex));
}
}
示例3: button1_Click
public void button1_Click(object sender, EventArgs e)
{
Properties.Settings.Default.UserName = textBox1.Text.ToString();
Properties.Settings.Default.Password = textBox2.Text.ToString();
lbAuth.Text = "";
pbxAuthOk.Visible = false;
pbxAuthFail.Visible = false;
try
{
using (Pop3Client client = new Pop3Client())
{
// Connect to the server pop.myopera.com
client.Connect("pop.myopera.com", 995, true);
// Authenticate ourselves towards the server /HejHej
client.Authenticate(Properties.Settings.Default.UserName, Properties.Settings.Default.Password);
if (client.Connected == true)
{
pbxAuthOk.Visible = true;
lbAuth.Text = "Authentication OK!";
Properties.Settings.Default.Save();
}
client.Disconnect();
}
}
catch (Exception)
{
pbxAuthFail.Visible = true;
lbAuth.Text = "Something's wrong! \nMaybe bad username or password..";
Properties.Settings.Default.UserName = null;
Properties.Settings.Default.Save();
if (Properties.Settings.Default.UserName != null)
{
lbCurrentUsr.Text = Properties.Settings.Default.UserName;
}
else
{
lbCurrentUsr.Text = "No Current user is saved.";
}
}
}
示例4: FindAndDownloadBudget
public bool FindAndDownloadBudget(BackgroundWorker bw)
{
bool attachmentFound = false;
try
{
Log.n("Kobler til e-post server \"" + main.appConfig.epostPOP3server + "\"..");
using (Pop3Client client = new Pop3Client())
{
client.Connect(main.appConfig.epostPOP3server, main.appConfig.epostPOP3port, main.appConfig.epostPOP3ssl);
if (bw != null) {
if (bw.CancellationPending) {
if (client.Connected)
client.Disconnect();
return false;
}
}
Log.d("Logger inn med brukernavn \"" + main.appConfig.epostBrukernavn + "\"..");
SimpleAES aes = new SimpleAES();
client.Authenticate(main.appConfig.epostPOP3username, aes.DecryptString(main.appConfig.epostPOP3password));
int count = client.GetMessageCount();
Log.d("Innlogging fullført. Antall meldinger i innboks: " + count);
if (count == 0)
{
Log.n("Innboks for \"" + main.appConfig.epostPOP3username + "\" er tom. "
+ "Endre innstillinger i ditt e-post program til å la e-post ligge igjen på server", Color.Red);
client.Disconnect();
return false;
}
main.processing.SetText = "Søker i innboks.. (totalt " + count + " meldinger)";
Log.n("Søker i innboks.. (totalt " + count + " meldinger)");
for (int i = count + 1; i-- > 1;)
{
if (attachmentFound || maxEmailAttemptsReached)
break;
if (bw != null)
if (bw.CancellationPending)
break;
Log.d("Sjekker meldingshode " + (count - i + 1) + "..");
MessageHeader header = client.GetMessageHeaders(i);
if (HeaderMatch(header))
{
if (header.DateSent.Date != selectedDate.Date)
{
Log.d("Fant C810 e-post med annen dato: " + header.DateSent.ToShortDateString()
+ " ser etter: " + selectedDate.ToShortDateString() + " Emne: \"" + header.Subject
+ "\" Fra: \"" + header.From.MailAddress + "\"");
continue;
}
Log.d("--------- Fant C810 e-post kandidat: Fra: \""
+ header.From.MailAddress.Address + "\" Emne: \"" + header.Subject
+ "\" Sendt: " + header.DateSent.ToShortDateString() + " (" + header.DateSent.ToShortTimeString() + ")");
Log.d("Laster ned e-post # " + i + "..");
Message message = client.GetMessage(i);
foreach (MessagePart attachment in message.FindAllAttachments())
{
if (attachmentFound)
break;
Log.d("Vedlegg: " + attachment.FileName);
if (AttachmentMatch(attachment))
attachmentFound = ParseAndSaveDailyBudget(attachment,
message.Headers.DateSent,
message.Headers.Subject,
message.Headers.From.MailAddress.Address);
}
}
if (!attachmentFound)
Log.d("Fant ingen C810 vedlegg i e-post # " + i);
}
client.Disconnect();
}
if (attachmentFound)
return true;
else if (!attachmentFound && maxEmailAttemptsReached)
Log.n("Maksimum antall e-post nedlastninger er overgått. Innboks søk er avsluttet", Color.Red);
else
Log.n("Fant ingen C810 e-post med budsjett for dato " + selectedDate.ToShortDateString() + ". Innboks søk er avsluttet", Color.Red);
}
catch (PopServerNotFoundException)
{
Log.n("E-post server finnes ikke eller DNS problem ved tilkobling til " + main.appConfig.epostPOP3server, Color.Red);
}
catch (PopServerNotAvailableException ex)
{
Log.n("E-post server \"" + main.appConfig.epostPOP3server + "\" svarer ikke. Feilmelding: " + ex.Message, Color.Red);
}
catch (Exception ex)
{
if (ex.Message.Contains("Authentication failed") || ex.Message.Contains("credentials"))
//.........这里部分代码省略.........
示例5: segundoplano_DoWork
private void segundoplano_DoWork(object sender, DoWorkEventArgs e)
{
Pop3Client emaiClient = new Pop3Client();
try
{
emaiClient.Connect(servidordeemail.Text, Convert.ToInt32(porta.Value), SSL);
emaiClient.Authenticate(usuario.Text, senha.Text);
if (!emaiClient.Connected) return;
var messages = new List<OpenPop.Mime.Message>();
Total_de_Emails = emaiClient.GetMessageCount();
for (var i = 1; i < Total_de_Emails; i++)
{
messages.Add(emaiClient.GetMessage(i));
segundoplano.ReportProgress(i);
}
Total_de_Emails = messages.Count;
int x = 0;
foreach (var msg in messages.Where(y => DateTime.Parse(y.Headers.Date) >= DataInicial && DateTime.Parse(y.Headers.Date) <= DataFinal && y.FindAllAttachments() != null))
{
x++;
var anexo = msg.FindAllAttachments();
foreach (var ado in anexo.Where(c => c.FileName.EndsWith(".xml")))
{
ado.Save(new FileInfo(Path.Combine(Caminho, ado.FileName)));
}
segundoplano.ReportProgress(x);
}
}
catch (Exception exception)
{
MessageBox.Show(exception.Message);
}
finally
{
if (emaiClient.Connected)
{
emaiClient.Disconnect();
emaiClient.Dispose();
}
}
}
示例6: fetch_messages
//.........这里部分代码省略.........
string rawMessage = Encoding.Default.GetString(mimeMessage.RawMessage);
string post_data = "username=" + HttpUtility.UrlEncode(ServiceUsername)
+ "&password=" + HttpUtility.UrlEncode(ServicePassword)
+ "&projectid=" + Convert.ToString(projectid)
+ "&from=" + HttpUtility.UrlEncode(from)
+ "&short_desc=" + HttpUtility.UrlEncode(subject)
+ "&message=" + HttpUtility.UrlEncode(rawMessage);
byte[] bytes = Encoding.UTF8.GetBytes(post_data);
// send request to web server
HttpWebResponse res = null;
try
{
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(Url);
req.Credentials = CredentialCache.DefaultCredentials;
req.PreAuthenticate = true;
//req.Timeout = 200; // maybe?
//req.KeepAlive = false; // maybe?
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
req.ContentLength = bytes.Length;
Stream request_stream = req.GetRequestStream();
request_stream.Write(bytes, 0, bytes.Length);
request_stream.Close();
res = (HttpWebResponse)req.GetResponse();
}
catch (Exception e)
{
write_line("HttpWebRequest error url=" + Url);
write_line(e);
}
// examine response
if (res != null)
{
int http_status = (int)res.StatusCode;
write_line(Convert.ToString(http_status));
string http_response_header = res.Headers["BTNET"];
res.Close();
if (http_response_header != null)
{
write_line(http_response_header);
// only delete message from pop3 server if we
// know we stored in on the web server ok
if (MessageInputFile == ""
&& http_status == 200
&& DeleteMessagesOnServer == "1"
&& http_response_header.IndexOf("OK") == 0)
{
write_line("sending POP3 command DELE");
client.DeleteMessage(message_number);
}
}
else
{
write_line("BTNET HTTP header not found. Skipping the delete of the email from the server.");
write_line("Incrementing total error count");
total_error_count++;
}
}
else
{
write_line("No response from web server. Skipping the delete of the email from the server.");
write_line("Incrementing total error count");
total_error_count++;
}
if (total_error_count > TotalErrorsAllowed)
{
write_line("Stopping because total error count > TotalErrorsAllowed");
stop();
}
} // end for each message
if (MessageInputFile == "")
{
write_line("\nsending POP3 command QUIT");
client.Disconnect();
}
else
{
write_line("\nclosing input file " + MessageInputFile);
}
}
}
示例7: ReceivingLoop
private void ReceivingLoop()
{
using (Pop3Client client = new Pop3Client())
{
for (; ; )
{
try
{
if (!client.Connected)
{
client.Connect("pop.gmail.com", 995, true);
client.Authenticate(mail_username, mail_password);
List<string> uids = client.GetMessageUids();
List<Message> newMessages = new List<Message>();
for (int i = 0; i < uids.Count; i++)
{
string currentUidOnServer = uids[i];
Message unseenMessage = client.GetMessage(i + 1);
newMessages.Add(unseenMessage);
}
for (int i = 0; i < newMessages.Count; i++)
{
Console.WriteLine("Message: " + newMessages.ElementAt(i).ToMailMessage().Body);
ConvertReceivedToOrder(newMessages.ElementAt(i).Headers.Subject, newMessages.ElementAt(i).ToMailMessage().Body);
}
}
}
catch (Exception e)
{
Console.WriteLine("Cannot connect: " + e.Message);
Thread.Sleep(2000);
}
finally
{
try
{
if (client.Connected) client.Disconnect();
do Thread.Sleep(500); while (client.Connected);
}
catch (Exception e)
{
Console.WriteLine("Cannot disconnect - reset connection: " + e.Message);
client.Reset();
Thread.Sleep(2000);
}
}
}
}
}
示例8: TestDeleteAllMessages
public void TestDeleteAllMessages()
{
const string welcomeMessage = "+OK";
const string okUsername = "+OK";
const string okPassword = "+OK";
const string messageCountResponse = "+OK 2 5"; // 2 messages with total size of 5 octets
const string deleteResponse = "+OK"; // Message was deleted
const string quitAccepted = "+OK";
const string serverResponses = welcomeMessage + "\r\n" + okUsername + "\r\n" + okPassword + "\r\n" + messageCountResponse + "\r\n" + deleteResponse + "\r\n" + deleteResponse + "\r\n" + quitAccepted + "\r\n";
Stream inputStream = new MemoryStream(Encoding.ASCII.GetBytes(serverResponses));
MemoryStream outputStream = new MemoryStream();
Pop3Client client = new Pop3Client();
client.Connect(new CombinedStream(inputStream, outputStream));
client.Authenticate("test", "test");
// Delete all the messages
client.DeleteAllMessages();
// Check that message 1 and message 2 was deleted
string[] commandsFired = GetCommands(new StreamReader(new MemoryStream(outputStream.ToArray())).ReadToEnd());
bool message1Deleted = false;
bool message2Deleted = false;
foreach (string commandFired in commandsFired)
{
if (commandFired.Equals("DELE 1"))
message1Deleted = true;
if (commandFired.Equals("DELE 2"))
message2Deleted = true;
}
// We expect message 1 to be deleted
Assert.IsTrue(message1Deleted);
// We expect message 2 to be deleted
Assert.IsTrue(message2Deleted);
// Quit and commit
client.Disconnect();
const string expectedOutputAfterQuit = "QUIT";
string outputAfterQuit = GetLastCommand(new StreamReader(new MemoryStream(outputStream.ToArray())).ReadToEnd());
// We now expect that the client has sent the QUIT command
Assert.AreEqual(expectedOutputAfterQuit, outputAfterQuit);
}
示例9: FetchAllMessages
public static List<Message> FetchAllMessages(string hostname, int port, bool useSsl, string username, string password)
{
using (Pop3Client client = new Pop3Client())
{
client.Connect(hostname, port, useSsl);
client.Authenticate(username, password);
int messageCount = client.GetMessageCount();
List<Message> allMessages = new List<Message>(messageCount);
for (int i = messageCount; i > 0; i--)
{
allMessages.Add(client.GetMessage(i));
}
client.Disconnect();
return allMessages;
}
}
示例10: test
//.........这里部分代码省略.........
List<EmailMap> em = new List<EmailMap>();
try
{
string dirPath = @"data\inbox\" + mp.email;
//serilize index.xml
/* if (File.Exists(dirPath+"\\index.xml"))
{
string confPath = dirPath + "\\index.xml";
var serializer = new XmlSerializer(typeof(List<EmailMap>));
using (var stream = File.OpenRead(confPath))
{
var other = (List<EmailMap>)(serializer.Deserialize(stream));
em.AddRange(other);
stream.Close();
}
}*/
List<EmailMap> emTmp = new List<EmailMap>();
// string[] paths= Directory.GetFiles(dirPath, "*", SearchOption.AllDirectories);
List<Message> allMessages = new List<Message>(messageCount);
int nCurCount = m_dicEmails[mp.email].Count;
// Messages are numbered in the interval: [1, messageCount]
// Ergo: message numbers are 1-based.
// Most servers give the latest message the highest number
for (int i = nCurCount + 1; i <= messageCount; i++)
{
// allMessages.Add(pop3Client.GetMessage(i));
Message msg=pop3Client.GetMessage(i);
string strSubject=msg.Headers.Subject;
string filename=pop3Client.GetMessageHeaders(i).MessageId;
emTmp.Add(new EmailMap { title = strSubject,file=filename });
//write to htm file
// If the selected node is not a subnode and therefore does not
// have a MessagePart in it's Tag property, we genericly find some content to show
// Find the first text/plain version
MessagePart plainTextPart = msg.FindFirstPlainTextVersion();
string strContent;
if (plainTextPart != null)
{
// The message had a text/plain version - show that one
strContent = plainTextPart.GetBodyAsText();
}
else
{
// Try to find a body to show in some of the other text versions
List<MessagePart> textVersions = msg.FindAllTextVersions();
if (textVersions.Count >= 1)
strContent = textVersions[0].GetBodyAsText();
else
strContent = "<<KibodWapon>> Cannot find a text version body in this message to show <<contact me qq408079058>>";
}
string strMailPath = dirPath + "\\" + filename + ".htm";
using (System.IO.StreamWriter file = new System.IO.StreamWriter(strMailPath))
{
file.WriteLine("<head><meta charset=\"UTF-8\"></head>");
file.WriteLine(strContent);
file.Close();
}
File.WriteAllText(dirPath + "\\" + filename + ".eml", Encoding.ASCII.GetString(msg.RawMessage));
}
//serilize index.xml
m_dicEmails[mp.email].AddRange(emTmp);
try
{
string confPath [email protected]"data\inbox\" + mp.email+"\\index.xml";
File.Delete(confPath);
var serializer = new XmlSerializer(typeof(List<EmailMap>));
using (var stream = File.OpenWrite(confPath))
{
serializer.Serialize(stream, em);
stream.Close();
}
}
catch (Exception ee)
{
Console.WriteLine(ee.Message);
}
}
catch (Exception UAEx)
{
Console.WriteLine(UAEx.Message);
}
pop3Client.Disconnect();
}
示例11: SetConnection
/// <summary>
/// connect to the email server by the user
/// </summary>
/// <returns></returns>
public bool SetConnection()
{
client = new Pop3Client();
try
{
client.Connect(user.pop3, user.port, user.ssl);
try
{
client.Authenticate(user.email, user.password);
return true;
}
catch
{
client.Disconnect();
}
}
catch
{
}
return false;
}
示例12: Main
static void Main(string[] args)
{
bool cnx = false;
String logMail = "[email protected]", logPass = "Espol2015";
int num = 0, band = 0;
Message message;
String subject;
String notif;
Console.WriteLine("Verificando conexión a internet...");
NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces();
foreach (NetworkInterface nic in nics)
{
if (
(nic.NetworkInterfaceType != NetworkInterfaceType.Loopback && nic.NetworkInterfaceType != NetworkInterfaceType.Tunnel) &&
nic.OperationalStatus == OperationalStatus.Up)
{
networkIsAvailable = true;
}
}
Console.Write("Conexión a Internet: ");
Console.WriteLine(networkIsAvailable);
NetworkChange.NetworkAvailabilityChanged += new NetworkAvailabilityChangedEventHandler(NetworkChange_NetworkAvailabilityChanged);
if (networkIsAvailable)
{
Console.WriteLine("Subrutina -- Lectura de Eventos Ignorar");
Console.WriteLine("Solicitando acceso a la cuenta de correo sist_segu_2015");
Pop3Client pop3Client = new Pop3Client();
pop3Client.Connect("pop3.live.com", 995, true);
pop3Client.Authenticate(logMail, logPass);
cnx = pop3Client.Connected;
Console.WriteLine("Solicitud de conexión a las " + DateTime.Now);
Console.WriteLine("Conectando...");
if (cnx == true)
{
Console.WriteLine("--- Conexión exitosa ---");
Console.WriteLine("Se realizó conexión exitosa a las " + DateTime.Now);
}
else
{
Console.WriteLine("--- Conexión fallida ---");
Console.WriteLine("Fallo de conexión a las " + DateTime.Now);
Console.WriteLine("Presione una tecla para salir...");
Console.ReadKey();
System.Environment.Exit(0);
}
num = pop3Client.GetMessageCount();
Console.WriteLine("Usted tiene {0} correos en su bandeja", num);
Console.WriteLine("Leyendo correos, buscando notificación IGNORAR...");
for (int i = 1; i <= num; i++)
{
message = pop3Client.GetMessage(i);
subject = message.ToMailMessage().Subject;
if (subject == "IGNORAR")
{
notif = message.ToMailMessage().Body;
Console.WriteLine("Contenido del correo: " + notif);
pop3Client.DeleteMessage(i);
Console.WriteLine("Se ha notificado al programa la captura del evento IGNORAR enviada por el usuario");
band = 1;
}
else
{
Console.WriteLine("Leyendo {0} correos...", i);
}
}
if (band == 0)
{
Console.WriteLine("No se han encontrado notificaciones...");
}
pop3Client.Disconnect();
Console.WriteLine("La subrutina fue desconectada a las " + DateTime.Now);
Console.WriteLine("Presione una tecla para salir...");
Console.ReadKey();
}
else
{
Console.WriteLine("No hay conexión a Internet, por favor verificar el inconveniente");
Console.ReadKey();
}
}
示例13: fetchAllMessages
// Run by Worker, gets messages into a list.
private static void fetchAllMessages(object sender, DoWorkEventArgs e)
{
try
{
int percentComplete;
// The client disconnects from the server when being disposed
using (Pop3Client client = new Pop3Client())
{
// Connect to the server pop.myopera.com
client.Connect("pop.myopera.com", 995, true);
// Authenticate ourselves towards the server /HejHej
client.Authenticate(Properties.Settings.Default.UserName, Properties.Settings.Default.Password);
// Get the number of messages in the inbox
int messageCount = client.GetMessageCount();
// We want to download all messages
List<OpenPop.Mime.Message> allMessages = new List<OpenPop.Mime.Message>();
// Messages are numbered in the interval: [1, messageCount]
// Ergo: message numbers are 1-based.
// Most servers give the latest message the highest number
for (int i = messageCount; i > 0; i--)
{
allMessages.Add(client.GetMessage(i));
percentComplete = Convert.ToInt16((Convert.ToDouble(allMessages.Count) / Convert.ToDouble(messageCount)) * 100);
(sender as BackgroundWorker).ReportProgress(percentComplete);
}
// Now return the fetched messages to e
e.Result = allMessages;
client.Disconnect();
}
}
catch (Exception ex)
{
MessageBox.Show("Connection Failed, maybe you forgot to set a user in Settings?" + ex.Message);
}
}
示例14: RefreshingThread
private void RefreshingThread()
{
Pop3Client client = new Pop3Client();
client.Connect(config.host, config.port, config.ssl);
client.Authenticate(config.login, config.password);
List<string> uids;
int length = 0;
while(true)
{
uids = client.GetMessageUids();
length = uids.Count;
for (int i = 0; i < length; i++)
{
string currentUidOnServer = uids[i];
if (!readMails.Contains(currentUidOnServer))
{
unreadMails++;
// Add the message to the new messages
readMails.Add(uids[i]);
}
}
//outLabel.Text = unreadMails.ToString();
Thread.Sleep(config.msRefreshDelay);
}
client.Disconnect();
}
示例15: crackProc
public void crackProc()
{
Pop3Client pop3Client = new Pop3Client();
do
{
string strPop3;
int port;
string strUser;
string strPwd;
bool isSLL;
m_gM.WaitOne();
if (m_nCreackingIndex > listCheckableEmails.Count - 1)//finished
{
m_gM.ReleaseMutex();
return;
}
strUser = listCheckableEmails[m_nCreackingIndex].email;
strPwd = listCheckableEmails[m_nCreackingIndex].pwd;
//check form invalide emails
string strDomain;
try
{
strDomain = strUser.Split('@')[1];
}
catch (Exception ex)
{
m_nCreackingIndex++;
m_gM.ReleaseMutex();
return;
}
//try dic
try
{
strPop3 = m_dicPopServers[strDomain].pop3;
port = m_dicPopServers[strDomain].port;
isSLL = m_dicPopServers[strDomain].isSSL;
}
catch (Exception ex)
{
m_nCreackingIndex++;
m_gM.ReleaseMutex();
return;
}
m_nCreackingIndex++;
m_gM.ReleaseMutex();
try
{
if (pop3Client.Connected)
pop3Client.Disconnect();
pop3Client.Connect(strPop3, port, isSLL);
pop3Client.Authenticate(strUser, strPwd);
int count = pop3Client.GetMessageCount();
Console.WriteLine(count);
int i = m_nCreackingIndex - 1;
//update
m_gM.WaitOne();
SetText(labelStatus, "成功登陆:" + strUser + "请等待!!!~");
//labelStatus.Text = "成功登陆:" + strUser + "请等待!!!~";
if (m_nFinished + 1 == listCheckableEmails.Count)//finished
{
SetText(labelStatus, "恭喜检测完成。。~");
MessageBox.Show("恭喜检测完成");
//labelStatus.Text = "恭喜检测完成。。~";
SetButton(buttonEnd, false);
SetButton(buttonStart, true);
SetButton(buttonPause, false);
SetButton(buttonAllTrans, true);
SetButton(buttonExpCracked, true);
SetButton(buttoneExpUnknown, true);
// buttonEnd.Enabled = false;
//buttonStart.Enabled = true;
//buttonPause.Enabled = false;
}
if (!listLogined.Exists(x => x.email == strUser)) //add
{
Console.WriteLine(strUser+" "+strPwd+" not exist");
// Console.WriteLine(listCheckableEmails[i].email);
ListViewItem item1 = new ListViewItem(strUser, 0);
item1.SubItems.Add(strPwd);
AddItemToListView(listViewCreacked, item1);
// listViewCreacked.Items.Add(item1);
//listViewCreacked.Update();
listLogined.Add(new MailPwd() { email = strUser, pwd = strPwd });
}
m_gM.ReleaseMutex();
}
/*catch (InvalidLoginException)
{
MessageBox.Show(this, "The server did not accept the user credentials!", "POP3 Server Authentication");
}
//.........这里部分代码省略.........