473,664 Members | 2,770 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

check unread emails?

92 New Member
i wanna get number of unread mails from mail servers, like gmail, yahoo, msn, aim and any other email server which user gives

but the problem is - i dont know HOW (lol) i tried this DLL: http://www.lesnikowski.com/mail/faq.aspx but in its faq it says this:
That is not possible with POP3 protocol. There is no way to mark on the server which messages were received by client application. You have to mark which messages have been read by yourself.

The Windows Live Messenger shows unread mails in messenger, i just wanna implement in my own app, i dont wanna show the mails, i just want the number of unread mails, please note - i m newbie at this Net stuff :), and yes its a C# windows forms

[Edit]
i did some research and *i m not sure* but IMAP can read the number of unread mails?, but do yahoo, msn, gmail, aol and other services support IMAP? if yes then how can i implement IMAP in my application because all the DLL's out there ask money and i dont wanna spend money.. EAGetMail DLL works like a charm but its 30 day trial - argghhh
Sep 30 '09 #1
17 19212
liadmz
32 New Member
After you have a connection to the server send the command:
"list"

the server then will replay:
+OK 1 414
when +OK state the the command is recognized by the server
1 - is the number of unread emails
414 - is the emails capacity.
Oct 1 '09 #2
vishal1082
92 New Member
@liadmz
OMG AWESOME!! but how to establish connection to the server (lol)
Oct 1 '09 #3
liadmz
32 New Member
Here is a class I'm working on.
You need to add it to your project and create a new object.

MailHandler X = new MailHandler();

MailHandler.zip

Set the POP3 and SMTP setting using:
X.SetSMTP(txtSM TP_server.Text, txtSMTP_user.Te xt, txtSMTP_pass.Te xt);
X.SetPOP(txtPOP _server.Text, txtPOP_user.Tex t, txtPOP_pass.Tex t);

To count the emails on the server use:
int EmailCount = X.RetrieveMailC ount();

Hope this one will help.
Oct 1 '09 #4
vishal1082
92 New Member
well i dont want total mail counts but want only the count of unread mails, and i m leaving the idea of IMAP because Yahoo and Hotmail dont give IMAP support ffs...
Oct 1 '09 #5
vishal1082
92 New Member
cmon guys please help i need help please!!!!!!!
Oct 1 '09 #6
cloud255
427 Recognized Expert Contributor
Have you tried looking at the Yahoo mail api?
Oct 1 '09 #7
vishal1082
92 New Member
@cloud255
yea.....but its only for yahoo... and i need gmail, and aol, and hotmail

but i have decided

i am gonna forget hotmail for now and work on Gmail, Aol, and Yahoo
Yahoo has an API so no problems there,
now Gmail and AOL
both support IMAP,
i wrote this code:
Expand|Select|Wrap|Line Numbers
  1.  TcpClient objTCP = new TcpClient();
  2. SslStream sslstream = default(SslStream);
  3. //StreamReader reader = null;
  4. objTCP.Connect("imap.gmail.com", 993);
  5. sslstream = new SslStream(objTCP.GetStream());
  6. sslstream.AuthenticateAsClient("imap.gmail.com");
  7. // authenticate as client GMAIL
  8. // Assigned reader to stream
  9. //reader = new StreamReader(sslstream);
  10. sendcmd("$ LOGIN (my email) (my password) $ STATUS INBOX (unseen)", sslstream);
  11. //string messageCount = sendcmd("$ STATUS INBOX", sslstream);
  12. objTCP.Close();
  13.  
  14. private static string sendcmd(string cmd, SslStream NetStrm)
  15. {
  16.          byte[] szData;
  17.          string returnedData = "";
  18.          StreamReader RdStrm = new StreamReader(NetStrm);
  19.          szData =
  20.          System.Text.Encoding.ASCII.GetBytes(cmd.ToCharArray());
  21.          NetStrm.Write(szData, 0, szData.Length);
  22.          returnedData = RdStrm.ReadLine();
  23.          return returnedData;
  24. }
  25.  
but it doesnt seem working, it dont work if i write the commands in different lines too...
i dont wanna use any freaking 3rd party IMAP stuff to connect, so any way to connect to IMAP without 3rd party ****?
Oct 1 '09 #8
tlhintoq
3,525 Recognized Expert Specialist
Time to stop... take a deep breath...

Yahoo has an api, so you are good there.
You were given a command to ask IMAP for the number of unread messages.
After you have a connection to the server send the command:
"list"

the server then will replay:
+OK 1 414
when +OK state the the command is recognized by the server
1 - is the number of unread emails
414 - is the emails capacity.
You were handed an entire class of code for connectivity.

but it doesnt seem working, it dont work
doesn't give anyone any idea what the problem is? Exception... server error... empty data...

After all the help you've been given including someone else's source code outbursts like
i dont wanna use any freaking 3rd party IMAP stuff to connect, so any way to connect to IMAP without 3rd party ****?
just seem a little out of place.

I suggest you take a day or even the weekend to first relax, then read back through all the help you've been given, then try to combine some of these fine suggestions.

Come MONDAY: If after that and giving it several of your best "trial and error" attempts you are still having issues, post them with details that could help someone, to help you.
Oct 1 '09 #9
vishal1082
92 New Member
cls
okay cleared my mind, the source i was given is for POP3 not for IMAP, i tried using it with IMAP at the first command (even if i write "guwag") it will reply "+OK CONNETED then some ip bla bla", and when i give it 2nd command it wont reply and app is just stuck waiting for some reply from server...

i just want a simple code to get unread mails from a IMAP server, cmon is that so tuff? :\
Oct 1 '09 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

2
1497
by: zee | last post by:
Hello there I would like to create an add-in for outlook which looks at all the new email (unread), if they contain particular text on the subject, then a link gets added to the bottom of the email or an attachment can be added.
2
3116
by: mshngo | last post by:
Hi, What would be the best way to check whether an istringstream object has empty buffer? I wanted to do something like: istringstream isStr(myStringContent.c_str()); while (isStr_BUFFER_IS_NOT_EMPTY) { //do something }
1
2217
by: Kondapanaidu | last post by:
Hi, I am using C#.NET2.0, My Outlook Inbox is having some mails. My system Configured with Outlook, I need to capture the Unread mail subject line. How to capture the subject line from the unread mail.
12
14523
by: tshad | last post by:
What would be a good way to check programmatically whether a service was running? We have a service that dies periodically and I need to check to see if this service is running. I know how to check to see if the status is in stopped or running mode. But that doesn't tell me if it is actually running. I need to know this so that if it happens I can programmatically start the same service on another machine.
2
1986
by: a | last post by:
keep a list of read and unread items hi guys i m building an rss reader and i want you suggestions for datastructure for keeping read and unread list for each use i m assuming it will be very sparse thanks
1
7043
by: PhilD | last post by:
My C#.NET console app checks a public folder every 24 hours for incoming emails. For each unread email in the folder, it copies any attachments to the network, then loads the contents of these files into a SQL Server database, and marks the email as read. My problem is that in the loop that checks for all the Unread emails in the folder, as I spin through the loop, the number of unread items is being reset for every iteration. So...
8
5147
by: Army1987 | last post by:
Is this a good way to discard unread data after scanf()? while (getchar() != '\n') ; According to the FAQ scanf always leaves the trailing newline on the input stream, so there's no risk of discarding any more than needed. (In the best case, when scanf() correctly works and the user hasn't input spurious data beside those required in the control string, the loop will only iterate once.)
6
2584
realin
by: realin | last post by:
hi guys, i found a php mail class on phpclasses i just want to know how can i receive email after specific time. Allright, let me be more clear, i want that as soon as user sends an email to a particular email address, the reply for a thread is posted. So for that purpose i want my script to check for the new emails, there are two ways to do that, which i could think of. 1) I click a button manually everytime i need to check for new...
0
1135
by: Sheena777 | last post by:
How can Check all the new unread mail's subject with vb.net?I want to be able to check the mail's subject and then perform a specific action to that mail.How Can I do this using Vb.net and Outlook 2000.
0
8438
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8348
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8779
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8549
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7376
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6187
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4186
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2765
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2004
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.