1

can anyone here help me to solve the exception error "server not found". i believe all the parameter that i set is correct but i wonder why exception still occur.Tq

this is part of my code:

private void button_extract_Click(object sender, RoutedEventArgs e)
{
  HeadersFromAndSubject("pop@gmail.com",995,true, textbox_email_retriever.Text, 
    passwordBox_Receiver.SecurePassword.ToString(), 10);
}

public static void HeadersFromAndSubject(string hostname, int port, bool useSsl, 
  string username, string password, int messageNumber)
{
  using (Pop3Client client = new Pop3Client())
  {
    client.Connect(hostname, port, useSsl); //error in this line
    client.Authenticate(username, password);
  }
}
Konrad Viltersten
  • 36,151
  • 76
  • 250
  • 438
Firdaus
  • 31
  • 1
  • 5
  • hostname should be pop.gmail.com. Try it and let us know. – Tariqulazam Oct 22 '12 at 04:28
  • I would recommend IMAP and not POP3 - especially if you just want to extract the headers and the subject. – Burhan Khalid Oct 22 '12 at 04:34
  • Tq Tariqulazam.Solved. now the second error "Server did not accept user credentials". i guess the problem maybe from passwordbox. anyone know how to fix it.Tq – Firdaus Oct 22 '12 at 04:35
  • @Firdaus Check this [link](http://stackoverflow.com/questions/6474114/retrieve-email-using-c) it would help to solve – thar45 Oct 22 '12 at 04:54

1 Answers1

1

Should use the server name as below , I dont think it not an gmail account to have it as mail id format , only for authentication we are suppposed to use the mail id , try with this

 pop.gmail.com"

Instead of this

 pop@gmail.com 

Correct me if 'm wrong

thar45
  • 3,518
  • 4
  • 31
  • 48