Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
IMAP Email Driver
#1
Hey all,
   Got stuck in an airport for a disgusting amount of time this week, so I decided to to push forward on a project from the checklist. I could have gotten there faster by mule....possibly. Anyways, so without (any more) delay, I'd like to announce the IMAP Email driver. Really exciting, I know. Actually surprised no one has done it before now, but wuench's driver has done it for me (and likely many others) until now.

I won't explain the differences between POP3 and IMAP, that's up to you to explore.Wink

Be sure to read below on what is currently working and what is still in development......

// Version 1.0 - (Beta)    June  2017
//
//   Initial release, built for IMAPv4, RFC 3501
//      -- Designed to parallel wuench's POP3 driver in functionality
//
//      -- Connects to a single IMAP mailbox, provides fields for total and unread email counts
//      -- Processes any unread emails, imports subject/date/from into field lists
//      -- Updates custom fields based on properly formatted command(s) in text body of email
//
//  IMAP Design Notes:
//      -- IMAP protocol can support multiple commands simultaneously, but try to keep all ops serial
//      -- IMAP updates (new messages info or flag changes) will be transmitted at any time by server, even during other ops
//      -- While a active operation semaphor could be implemented, it has not to allow for flexibility (for now?)
//      -- After inital login and mailbox selection, SEARCH command is performed to request latest unread email(s)
//      -- Each new email is fetched and parsed for custom field commands        
//      -- Only essential IMAP protocol support, does not support attachments
//
//  Working:
//      -- Initial connection, login
//      -- Poll frequency alteration,
//      -- Debug mode >> dumps detailed data to log file
//      -- Mailbox connection and counts (total/unread) updates
//      -- Diagnostic fields: Server IP, driver version fields, last Poll success duration/time,
//      -- IMAP server 'Capability' response field
//      -- Reads params from config file
//      -- Creates any fields defined in config file for email parsing output
//      -- Downloads message bodies, parses them for output and/or Authentication string
//
//  InTest:
//      -- Accepts Auth and/or custom field change command(s) on same/multiple lines
//      -- Header, Date, Subject list >> updates after new email
//      -- Verify can update all field types -- String, Card, Int, Float, and Boolean
//      -- GetMail - manual email download (debug/testing expected usage only)
//      -- Delete command emails when enabled
//      -- Should handle ANY number of field triggers, depending on system memory and field name uniqueness
//      -- New email(s) fetch/process upon notify
//
//  InWork:
//      -- Retains email processing to avoid work duplication upon reconnection - cache to local file
//
// Usage:
//      -- WARNING: Use sTunnel (or alternative) for network security
//      -- Polling interval is field/user configurable
//      -- Auth tokens should be included in body text BEFORE any field change commands
//      -- Enable of 'DeleteCommandEmails' is recommended to avoid repeated field value change action



Here is the contents of sample config file the driver needs:

###############        CONFIG FILE - for CQC IMAP Device Driver        ###############
####
#### ---- One config item per line, Use '~' for seperator. Lines with '#' will be ignored. ---- ####
####
UserName~someone@nowhere.com
Password~SecurePassword

# How often do we verify connection is still alive and process new emails?
PollInterval~30000

# Enable for command parsing of email body text
CommandEnable~True

# Authenication string that must be included for command emails, use blank to disable
CommandAuthToken~SomeStringThatShouldNeverExist-MaybeUseSomethingMoreComplex?JustDon'tUsetheSepChar!

# Enable for deletion of any emails that contained parsed commands
DeleteCommandEmails~True

#
# Add additional custom fields on seperate lines
CustomField~CheckTestField~String

# DebugEnable will dump debugging and detailed logging to a local file in MacroFileRoot
DebugEnable~False
# Not sure if this will be required to be changed for others, it wasn't for my needs
MailboxName~INBOX


Clearly there is still more development to perform, but I would say 'Medium' confidence in stability and release level.

Please leave a post just to let me know you are using the driver. Thanks!


Attached Files
.cqcdrvpack   IMAP-v1-0.2017.06.05.CQCDrvPack (Size: 21.92 KB / Downloads: 1)
Reply
#2
Let me know if there's any underlying functionality that is missing to get it done.
Dean Roddey
Software Geek Extraordinaire
Reply
#3
(05-27-2017, 08:12 PM)whozeawhat Wrote: Hey all,
   Got stuck in an airport for a disgusting amount of time this week, so I decided to to push forward on a project from the checklist. I could have gotten there faster by mule....possibly. Anyways, so without (any more) delay, I'd like to announce a future IMAP Email driver. Really exciting, I know. Actually surprised no one has done it before now, but wuench's driver has done it for me (and likely many others) until now.

-- I'll attach a beta version of driver in the next week, or so, after I find a few more bugs myself. Here's my notes so far, please feel free to chime in and give your thoughts/ideas.



//   Initial release, built for IMAPv4, RFC 3501
//      -- Designed to parallel wuench's POP3 driver in current planned functionality
//
//      -- Connects to a single IMAP mailbox, provides fields for total and unread email counts         
//      -- Only essential IMAP protocol support, does not support attachments (is this desired?)
//
//  Working:
//      -- Initial connection, login
//      -- Poll frequency alteration,
//      -- Debug mode >> dumps detailed data to log file
//      -- Mailbox connection and counts (total/unread) updates
//      -- Diagnostic fields: Server IP, driver version fields, last Poll success duration/time,
//      -- IMAP server 'Capability' response field
//
//  ToDo:
//      -- Reads params from config file
//      -- Creates any fields defined in config file for email parsing output
//      -- Downloads message bodies, parses them for output and/or Authentication string
//      -- Tracks email processing to avoid work duplication
//      -- Header & Subject Lists ( for latest 10 messages ?)

FWIW, I could see attachments being desired; i.e. send me a copy of some set of parameters stored in a file at a predefined frequency.  I don't know that I'd use it, but I could see it being requested by those that log things.
Flamin' Noobie...
Warp speed now and don't give me any of that dilythium crystal crap!
Reply
#4
if i understand correctly, this still requires stunnel to talk to gmail?

greg
Reply
#5
I would think so. CML doesn't have access to our secure sockets functionality, other than for HTTP.
Dean Roddey
Software Geek Extraordinaire
Reply
#6
i have beat my head against stunnel for some time. Never have gotten it to work. wish there was a simpler solution.

the pop3 driver fails repeatedly and stunnel shows this sequence over and over.

2017.06.13 21:35:18 LOG5[145]: Service [gmail-pop3] accepted connection from 192.186.1.103:58459
2017.06.13 21:35:18 LOG5[145]: s_connect: connected 74.125.202.108:995
2017.06.13 21:35:18 LOG5[145]: Service [gmail-pop3] connected remote server from 192.186.1.103:58460
2017.06.13 21:35:18 LOG5[145]: Connection closed: 65 byte(s) sent to TLS, 4461 byte(s) sent to socket
Reply
#7
Are you using an assigned application account associated with your gmail account or your user name for your stunnel config? I stopped using stunnel when Dean added gmail capability to CQC but when I did I did not have any issues setting it up on Windows
Reply
#8
i am not sure what an assigned application account is.  googled it and didnt see much.  i have an account that i created in gmail just for this project.  i enabled pop3 and set up the pop3 driver to point to localhost and port 5000.  i then installed stunnel with these settings:

; ***************************************** Example TLS client mode services

[gmail-pop3]
client = yes
accept = 5000
connect = pop.gmail.com:995
verifyChain = yes
CAfile = ca-certs.pem
checkHost = pop.gmail.com
OCSPaia = yes
Reply
#9
(06-14-2017, 06:12 AM)batwater Wrote: Are you using an assigned application account associated with your gmail account or your user name for your stunnel config?  I stopped using stunnel when Dean added gmail capability to CQC but when I did I did not have any issues setting it up on Windows

In this case, he's not sending e-mails via CQC, he's using a driver that pulls down e-mails.
Dean Roddey
Software Geek Extraordinaire
Reply
#10
got it working. i replaced localhost with the machines ip address and it worked. makes no sense but i'll take it.

greg
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Vantage Controls Driver for Infusion System KenC 3 716 10-23-2017, 12:10 PM
Last Post: Dean Roddey
  Another SMS Driver - SMS Global, one for everyone else znelbok 21 5,771 10-21-2017, 07:19 PM
Last Post: znelbok
  Monoprice Blackbird 4x4 HDMI Switcher - Driver request batwater 9 4,876 10-14-2017, 05:30 PM
Last Post: rtarver
  XBMC Driver wuench 419 118,768 07-02-2017, 11:04 AM
Last Post: Dean Roddey
  Which JVC Projector Driver indygreg 29 6,038 05-12-2017, 08:29 AM
Last Post: Dean Roddey
  Amazon Echo Hue Simulator Driver wuench 101 22,836 05-02-2017, 09:38 AM
Last Post: Dean Roddey
  SageTV Player V2 Driver chmilar 6 1,777 04-14-2017, 03:36 PM
Last Post: chmilar
  SageTV Driver George M 16 3,336 02-16-2017, 07:10 PM
Last Post: Dean Roddey
  ADA Suite 16 driver assistance zane 3 1,521 01-17-2017, 06:27 AM
Last Post: zane
  Sage Media Server driver (beta) Fonceur 696 128,927 01-06-2017, 05:34 PM
Last Post: Dean Roddey

Forum Jump:


Users browsing this thread: 1 Guest(s)