We need 2 small components (C++ classes - written in VC++ 6.0), if can't do one of them, bid
anyway, but indicate which one you gonna do. First component to work with Yahoo Mail server,
using Yahoo Mail protocol (they don't allow POP3, have their own protocol), second to work
with Hotmail (they also don't allow POP3, utilize another protocol). I will provide sample
code which utilizes both protocols, you will just need to cut off unnecessary stuff and wrap
it inside interface (C++ class) with functionality described below.
Each component: connects to mail server, logs on (using provided username/password), counts
number of new e-mails and returns this count along with last unread item position (like
'cookie'). Upon first connection - it assumes no new e-mail, but then, counts from last
position ID (this ID is maintained by the caller). For example, I could have the following
in my mailbox initially:
When I call the component for the first time (e.g. call 'GetNewMail' method), it returns '0'
(no new e-mails) and some sort of position idenitifier (e.g. time of last e-mail or
something else, which uniquely identifes e-mail). Then imagine is a couple of new items
arrive in this mailbox:
When I call component this time and pass item ID from previous call, I get '2' (2 new
items). If a couple new items arrive again, I get '4' (2 previous + 2 new) etc.
The component shall return LastID along with count. For example if I had 6 items and
component treats 4 of them as new - the component would return ID of 6th item. 'time' field
of event, maybe, or something more unique, if possible). And then we would pass this ID to
component some of the call - and if we do - it returns count of items only since this ID.
For example if I had 6 items (the example above) and then 7th item arrive - I pass last ID -
and get '1' (only one new items since those 6).
Time field as ID is not good because 2 or more e-mails can arrive at the same second, or
daylight saving setting can be switching at the time of checking, so if possible, some sort
of more unique ID should be returned. However, if none exists, you can use time.
Also, component shall have 'ReadMail' method which opens web browser and logs it on
automatically so you don't have to enter webmail URL (e.g. [url removed, login to view] or [url removed, login to view])
and put username/password there.
I will provide sample code for component with similar functionality but implemented for
POP3. Basically it does all said above - logs on, counts new e-mails, return last position
etc. So you just need to replace POP3 code with hotmail/yahoo code extracted from my samples
(I'll provide thise to winning bidder).
Component interface, just to illustrate it better:
bool Init (LPCTSTR user, LPCTSTR password, std::string* err_msg)
// Run browser
bool CheckMail(IN std::string cookie, OUT int* num_new_emails, OUT std::string* err_msg)
// Check mail - open web browser and do autologin
bool ReadMail (OUT std::string* err_msg)
// Mark as Read - returns new cookie.
bool MarkAsRead(OUT std::string* new_cookie) = 0