Hi, I receive emails in Mail with the following information. I would only like to pull out the info on the same line after the ‘:’
Mail contain this following fields;
Your full name:
Address Line 1:
Your full name: Mr Peter Smith
Telephone number: 04564
Result I am after:
The KM variable named ‘Your full name’ would hold the string 'Mr Peter Smith’
The KM variable named ‘Telephone number’ would hold the string ‘04564’
How can I do this in KM if it is possible?
March 10, 2017, 5:49pm
A very good starting point is the
KM Wiki article about Regular Expressions. It explains the basics, gives you examples, and – if you scroll down – many very useful links, also to existing Forum topics.
March 10, 2017, 6:15pm
Here is a basic example macro that works with your input sample:
_[example] Regex.kmmacros (3.0 KB)
Macro actions I am trying to achieve would really appreciate help with the first two points:
If an email is received that has the following in subject ‘“Apply Now” Form - Contact form on IronStone Legal’ Execute a macro (need help really having difficulty with this part)
Extract the entire content of the email into a variable (need help)
Sort from that variable using regular expressions into other variables (done)
Use those variables to add to the CRM (done)
Execute another macro (done)
March 16, 2017, 9:18pm
All this (except
#1) can be done relatively easily via AppleScript. As an example see this thread (doesn’t do what you want, but gives you straight basics on how to access Mail via AppleScript), or search the forum with “mail AppleScript” or similar.
#1, you are asking for a trigger when a mail comes in. Not sure how to realize this in KM, but the OS provides Notifications, so maybe going that route (with or without KM).