Reading E-Mail

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
Dave
Newbie
Posts: 17
Joined: Thu May 29, 2003 2:26 pm

Reading E-Mail

Post by Dave » Thu May 29, 2003 3:21 pm

I would like to be able to write a script that would read an e- mail, looking for cartain words or sentaces, and be able to respond to them. The problem I find is I cannot figure out how to get Macro Scheduler to read the e-mail. I thought of using the find word but it would just be a jumble of words. I need it to read each word in order from the begining of the mail to the end. Does anyone know how I would go about doing this? :?

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Thu May 29, 2003 7:45 pm

Might be able to help if you will provide more specific examples of what you are trying to do.....including examples of what you are searching for, specific words, sentences, phrases, amounts, etc. Any predictable format, layout, etc.? All of these can be very helpful to provide a unique sensible solution.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Post by armsys » Thu May 29, 2003 11:39 pm

Dave,

We've to know which email reader you intend to automate. Please help us help you.

Dave
Newbie
Posts: 17
Joined: Thu May 29, 2003 2:26 pm

Post by Dave » Fri May 30, 2003 2:56 am

I am using Outlook, and this would be for general e-mails. An example of this would be... HI this is your aunt, your uncle egghead died last week. This sentance might be somewhere in the 4th paragraph, but I would need it to read each word in order checking aganst a large data base of words and phrases so that it could piece together a sort of response based not just on each word but the context in which the sender is speaking. :?

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Fri May 30, 2003 3:51 am

Quick and dirty reaction, not thoroughly thought out yet:

=============================
:idea:
1. Copy the body of the email into a separate file and parse the file as follows.

A. (May need to determine how to handle words that are normally hyphenated before doing the next 2 steps. May have to temporarily replace those hyphens with a unique string like QUQU). Remove all hyphens at end of lines.

B. Replace all characters not A-Z or a-z or 0-9 with space character. This should end up with most words as pure words, separated by one or more "spaces". (If normally hyphenated words were protected like above, then now replace QUQU with the hyphen).

C. Replace all multiple "space"s with a single "space".

D. Replace every "space" with a return (end of line) character.

2. Make a loop to Use ReadLn> command since each word will now be on its own line.

3. Match the results of ReadLn against your master list.

4. Respond accordingly to the located words.

5. Repeat Loop till EOF.
=================================

Again, just my original reaction, will probably have other thoughts tomorrow.

Hope this helps to generate some other thoughts..... :arrow:
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Lumumba

Post by Lumumba » Mon Jun 02, 2003 3:54 pm

2 issues isn't it ?

a) how to get the mail (additionaly: in the right format) without to be trapped with "Outlook".
b) how to "read" it to identify the key words

-> a) have a look at one of my prevoius postings. Another application is used to get a mail quite right in a usefull format.

-> b) "find" would be fine.

Code: Select all

Let>keyword=honeypie
Run Program>cmd /c find /c "keyword" C:\DownloadedMails\GreetingsFromMomMail.txt > C:\MailScanResult.txt
ReadLn>C:\MailScanResult.txt,1,NumOfFoundKeywords
If>NumOfFoundKeywords>0,Reply
Goto>End

Label>Reply
SMTPSendMail>[email protected],TheWhiteHouse,[email protected],Yes I love you too,,

Label>End
Message>Done!

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Mon Jun 02, 2003 4:44 pm

Thanks for that info Lumumba.

:?:I've got a question about GetMail. It this is used vs. an "normal conventional email package", then I would suspect that there is a little more exposure for viruses? Most "normal" packages can be scanned automatically by Anti-virus programs.

Is there something special that needs to be done to anti-virus program configurations to scan results of GetMail processes? :?:
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Lumumba

Post by Lumumba » Tue Jun 03, 2003 9:56 am

I'm sorry Bob,
please check the links for GetMail and the Blat in one of my previous postings (or one of Ernest's) to get additional information about'm. I've picked it up while searching for commandline tools but never used it myself :roll:

But as long as mails downloaded as plain text, viruses shouldn't be a problem ...

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts