Author Topic: How to ID msgs?  (Read 215 times)

Strahan

  • Newbie
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
How to ID msgs?
« on: February 11, 2018, 10:36:29 PM »
Hi.  I'm writing a tool that will collect emails via IMAP and store them in my local SQL server.  I don't want to redownload stuff I already got, so I was thinking of how I may go about identifying the emails.  I saw the .getImapUid() method and assumed it would have some sort of ID unique to the email so I coded around that assumption.  In practice, it didn't work.  My code did:

Code: [Select]
log(3, "Logging email ID " + msg.GetImapUid().ToString() + " [" + msg.Subject + "]");
and the output in the log was:

Code: [Select]
[2018-02-11 22:25:14][3]: Logging email ID -1 [Updates to the eBay User Agreement.]
D'oh!  After further reading I saw that UID isn't the reliable option I thought it was.  So I thought maybe I'd do an MD5 hash of subject, from email and date sent but I just wanted to see if there is a "proper" solution for this....?

Thanks!