Examples of using SET to parse incoming email

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
tford
Posts: 4238
Joined: Sat Mar 10, 2007 6:44 pm

Examples of using SET to parse incoming email

Post by tford »

Can anyone provide sample rules for processing incoming email using the SET action. Or perhaps does anyone know if any of the sample apps use SET?

I'm attempting to use it for the first time & getting tripped up.
Tom - V8.8 build 3137 - MySql / PostGres
customaware
Posts: 2405
Joined: Mon Jul 02, 2012 12:24 am
Location: Ulaanbaatar, Mongolia

Post by customaware »

Hi Tom,


I use it like this.....


I send an email with an attached report of all Leave Applications approved by that person in the last month.

This idea is they print it, sign it and then send it back as an attachment in a reply to the email they received in the first place.

So, in the Subject of the outgoing email....

ApproverName#<<RegularUser.DisplayName>>#FromDate <<FIRST_DAY_OF_MONTH(DATE_ADD(CURRENT_DATE,-1))>>#ToDate#<<LAST_DAY_OF_MONTH(DATE_ADD(CURRENT_DATE,-1))>>

When they send back the signed for then their Subject is likely to have a Re: or a Fwd: at the start....So, I strip them
off and then use the remainder of the Subject Line to populate a new record for the received response....



ReceivedEmail.Subject=REPLACE_PATTERN(ReceivedEmail.Subject,'Re: ','')
ReceivedEmail.Subject=REPLACE_PATTERN(ReceivedEmail.Subject,'Fwd: ','')
CREATE ReturnedApproverApprovals WITH ReturnedApproverApprovals.DateReceived=CURRENT_DATE,ReturnedApproverApprovals.SignedApprovalForm=ReceivedEmail.Attachment1
SET ReturnedApproverApprovals FROM ReceivedEmail.Subject

Hope that helps.

MC&HNY
Cheers,
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Image
tford
Posts: 4238
Joined: Sat Mar 10, 2007 6:44 pm

Post by tford »

HTML in my email message was causing issues.

Did some additional testing & the problem is that I was sending an email from AwareIM to Gmail (using a Plain Text message attribute), then clicking replay on the Gmail to send it back to AwareIM.

Gmail was adding in HTML to the reply.

Prelim tests sending the same email to an email account on our Exchange server did not have the same issue of adding HTML to the reply.
Tom - V8.8 build 3137 - MySql / PostGres
Post Reply