Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^3: is it possible to use Perl to process Outlook emails?

by ~~David~~ (Hermit)
on Jul 26, 2011 at 18:05 UTC ( [id://916815]=note: print w/replies, xml ) Need Help??


in reply to Re^2: is it possible to use Perl to process Outlook emails?
in thread is it possible to use Perl to process Outlook emails?

Well, if you want a really backwards way to do it ( which is how I do it! ), i do it like the following:
1. Set up a complex rule in Outlook so that when a message arrives, the following sequence occurs:
a) Outlook can start up a program for you in the rule, i use it to start my perl program, which waits for:
b) Run the following VB script to save the email to a local file, which your perl script is polling
Sub WriteEmailToFile(MyMail As MailItem) Dim myMailEntryID As String Dim myMailBody As String Dim outlookNameSpace As Outlook.NameSpace Dim outlookMail As Outlook.MailItem myMailEntryID = MyMail.EntryID Set outlookNameSpace = Application.GetNamespace("MAPI") Set outlookMail = outlookNameSpace.GetItemFromID(myMailEntryID) Set fileSystemObject = CreateObject("Scripting.FileSystemObject") / you can create a dynamic text file name is you want... Set textFile = fileSystemObject.CreateTextFile("c:\temp\OutlookEma +il.txt", True) textFile.WriteLine (outlookMail.SenderEmailAddress) textFile.WriteLine (outlookMail.SentOn) textFile.WriteLine (outlookMail.Subject) outlookMailBody = outlookMail.Body 'strip non-printing characters For x = 127 To 255 While InStr(outlookMailBody, Chr(x)) > 0 outlookMailBody = Replace(outlookMailBody, Chr(x), "") Wend Next x textFile.WriteLine (outlookMailBody) textFile.Close End Sub

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://916815]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2024-04-24 05:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found