-2

How can I fetch an email, that has the subject I'm looking for in Hotmail using C#.

e.g. I want the emails(body/message) that has the word "Yahoo" in its subject.

Tried using many examples online but they weren't really clear. Thanks

Hoyo
  • 1,044
  • 3
  • 13
  • 23
  • 2
    You need to post some code or narrow down your question. Your question as it stands now is either "can someone write the code for me" or "can someone suggest a library for me", both of which are off-topic on Stack Overflow. – Lasse V. Karlsen Dec 19 '14 at 11:43

1 Answers1

1

You can connect to your hotmail account using the OpenPop.Net open source library. It has a lot of useful methods to communicate with a POP3 server. There is a lot of useful examples online. A simple code to connect to the POP3 server could work look this:

using(Pop3Client client = new Pop3Client())
{
    client.Connect(hotmailHostName, pop3Port, useSsl);
    client.Authenticate(username, password, AuthenticationMethod.UsernameAndPassword);

    // And here you can use the client.GetMessage() method to get a desired message. 
    // You can iterate all the messages and check properties on each of them. 
}

The hotmailHostName should be "pop3.live.com".
The pop3Port should be 995.
The useSsl should be true.

msporek
  • 1,187
  • 8
  • 21