bartekd Posted December 10, 2012 Posted December 10, 2012 Hello All, Is there a script that anyone has created that auto-saves incoming emails as txt in a directory? The subject and body should be readable somehow.
water Posted December 10, 2012 Posted December 10, 2012 Which mail client do you use? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
bartekd Posted December 10, 2012 Author Posted December 10, 2012 I use outlook. Either version 2000 or 2003.
water Posted December 10, 2012 Posted December 10, 2012 Unfortunately Outlook has to be version 2007 or later for AutoIt to be able to access events (like: "New Mail"). But you could try the other way round. Define a rule in Outlook to start your AutoIt script when a new mail arrives. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
bartekd Posted December 10, 2012 Author Posted December 10, 2012 Ya I could do that. Im not too sure where to start. I want it to save the email to text and maybe delete it. Do you know how I could accomplish that?
water Posted December 10, 2012 Posted December 10, 2012 (edited) First step would be to verify that Outlook 2000 or 2003 let you create a rule that executes a program when a new mail arrives (named "Run a Script Rule"). I run Outlook 2010 so can't check. Edited December 10, 2012 by water My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
bartekd Posted December 10, 2012 Author Posted December 10, 2012 Yes, I see the option to start an application if a email comes in. See below:
water Posted December 10, 2012 Posted December 10, 2012 Looks like you need to use VBA to process an incoming mail in Outlook 2000. VBS doesn't work according to this article or this MSDN article.Upgrading to Outlook 2007 isn't an option? Then it could easily be written in AutoIt. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
bartekd Posted December 11, 2012 Author Posted December 11, 2012 hmm, thats too bad. No I can't upgrade to 2007 because we don't have the license for it. Any other solutions?
czardas Posted December 11, 2012 Posted December 11, 2012 Have you tried to grab the text directly from the browser for this? It might be a viable alternative to trying to automate Outlook. operator64 ArrayWorkshop
water Posted December 11, 2012 Posted December 11, 2012 Another approach is to check the inbox for new (=unread) mails in a loop. This takes some processing power and isn't 100% save. IIRC the OutlookEX help & support thread has an example script. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
bartekd Posted December 11, 2012 Author Posted December 11, 2012 Ill take a look and see what I can find. The OutlookEX script is compatible with outlook 2000?
water Posted December 11, 2012 Posted December 11, 2012 I have tested it with Outlook 2002 (XP) and Outlook 2010. I think it should work with Outlook 2000 as well. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
bartekd Posted December 11, 2012 Author Posted December 11, 2012 Thanks again Water. ill try and let you know.
bartekd Posted January 20, 2013 Author Posted January 20, 2013 Sorry to go back to this. I have the work around which interfaces with the outlook 2000 and saves the email to HTML. So its working ok... but I would like it to be un-attended (in case the script fails, I have to keep half an eye on it). Is there any way of using SMTP to retrieve an email, save it as HTML to a folder, and then delete it from the email server? I looked around and there is lots of scripts for sending through SMTP but none that retrieve.
danielcovington Posted January 20, 2013 Posted January 20, 2013 Here is a link to a free COM object that can retrive email with POP, that you can automate with Auto-it. Download it, register it with regsvr32. Follow the documentation to create your script.http://www.system-engine.com/EmiaCtrlLite/
bartekd Posted January 20, 2013 Author Posted January 20, 2013 Thanks. Does that COM object support saving the HTML code of the email to a file? I can't see the instructions anywhere.
danielcovington Posted January 20, 2013 Posted January 20, 2013 It does. Look around the site a little it has VBscript examples to look at. I downloaded it and used it. Seems to be what you are asking for. It will download the messages to a string which you can then save to a file.
bartekd Posted January 20, 2013 Author Posted January 20, 2013 Would you be able to provide me the piece of code of what to do? Sorry I am not too familiar with VB and what needs to be done.
danielcovington Posted January 20, 2013 Posted January 20, 2013 You must register the dll first. Fill in the server,port,username,password in the functions. Also make sure if you are using a 64 bit OS that you run the script in 32bit mode or it will not work #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile=pop_test.exe #AutoIt3Wrapper_UseX64=n #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** dim $stat $pop_mail = ObjCreate("EmiaLITE.SendRetrieve") $pop_mail.set_POP3(server,port,username,password) $stat = $pop_mail.get_stat() ;this will get how many emails you have and the size of the mail box ConsoleWrite($stat.MessageCount&@CRLF&$stat.BoxSize&@CRLF) $pop_mail = "" $pop_mail = ObjCreate("EmiaLITE.SendRetrieve") $pop_mail.set_POP3(server,port,username,password) $pop_mail.connect_messageX_POP3() ;this will retrieve the 1st email from the server but not delete it off the server and display it in the console ;you can assign this to a variable and save it to a text file ;you will need to manipulate the string to get what you want from the string ConsoleWrite($pop_mail.get_message(1,0))
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now