viewpoint-particle

Author Topic: Watch Emails?  (Read 472 times)

MW4

  • Full Member
  • ***
  • Posts: 143
Watch Emails?
« on: June 21, 2017, 12:51:43 pm »
Does anyone know if there is code out there or if it's possible to "Watch" an email account (Outlook 365) and then do something, like the "Watch Folder then do something' code does?

I have datasets that come via e-mail and I'd like to program it out to run an SSIS script in order to append the new data to our SQL server table.

A point in the right direction would be appreciated.

td

  • Tech Support
  • *****
  • Posts: 2185
    • WinBatch
Re: Watch Emails?
« Reply #1 on: June 21, 2017, 01:26:00 pm »
Don't know of any example scripts but COM events using the Outlook email client object "Outlook.Application" is one possibility with WinBatch.  Of course you would need to have Outlook installed to use it.  The object has several events, like "NewMail" that could trigger another  script based on source or subject or something.   I have not tried  it so can't promise it will work, however.   Other standalone email clients allow you to setup triggers based on incoming email  and take some action like execute a script or program. 

There is always writing your own mini-client using the WinSock extender but that is likely more work than it is worth.
"Success is a lousy teacher. It seduces smart people into thinking they can't lose."
  - Bill Gates


JTaylor

  • Pundit
  • *****
  • Posts: 786
    • Data & Stuff Inc.
Re: Watch Emails?
« Reply #2 on: June 21, 2017, 02:40:43 pm »
Not sure if it is what you are wanting but I have, upon occasion, written scripts that check an email account and take action using the POSTIE Extender.  One is a registration process which takes the data and writes to a database.   Did that when I didn't have a good secure option on my web server.   Not that email is all that secure but better than what I had at the time.

Have another app somewhere that was designed to check an account and then take a specified action such as run an exe or such things.  Haven't looked at that one in years though.

I realize that without giving you code it isn't overly helpful but it wouldn't be that much different than what you will find as examples in the POSTIE Help file.   Once you have the message the rest would be specific to your task anyway.   If you really need an example I can see what I can track down but would suggest starting with the POSTIE Help file first.

Jim

MW4

  • Full Member
  • ***
  • Posts: 143
Re: Watch Emails?
« Reply #3 on: June 21, 2017, 03:07:22 pm »
JTaylor,
I'll get digging in on the postie, but if you could find that app, that would be worth looking at as well.

You'd think MSSQL would have something natively...


Thanks!!

JTaylor

  • Pundit
  • *****
  • Posts: 786
    • Data & Stuff Inc.
Re: Watch Emails?
« Reply #4 on: June 21, 2017, 05:45:27 pm »
I think you can send mail through MSSQL (remember reading something years ago) but that doesn't help, of course.

Jim

td

  • Tech Support
  • *****
  • Posts: 2185
    • WinBatch
Re: Watch Emails?
« Reply #5 on: June 22, 2017, 07:14:31 am »
JTaylor,
I'll get digging in on the postie, but if you could find that app, that would be worth looking at as well.


Take a look at the kGetMail function in the WIL Consolidated Help file - assuming you have the Postie extender installed.  The function's 'pat' parameter allows you to retrieve email with  specific  subject line content.  You can also use the function to delete messages so that you don't retrieve them again the next time you check for a specific subject line. 
"Success is a lousy teacher. It seduces smart people into thinking they can't lose."
  - Bill Gates


JTaylor

  • Pundit
  • *****
  • Posts: 786
    • Data & Stuff Inc.
Re: Watch Emails?
« Reply #6 on: June 23, 2017, 12:17:09 pm »
Hopefully you are making progress...I am moving in three days and am in full packing mode and my wife thinks that is more important :)    Happy to help further but will be a few days.

Jim