Using the SET action for incoming emails

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
ddumas
Posts: 389
Joined: Tue Apr 23, 2013 11:17 pm

Using the SET action for incoming emails

Post by ddumas »

In my application, I wish to implement user email back and forth exchange, keeping users' email addresses private from each other.

AwareIM doc points to being able to use the SET action in incomming emails. I think that might allow me to accomplish this. I know how to process incoming emails and create records in BOs, from them.

In the User Guide: "The SET action of the Aware IM Rule Language can be useful for analyzing the received e-mail provided that the body of the e-mail is in a format required by the SET action"

To accomplish this, I am thinking that can be done with the following:

Place a string (invisible if it can be done can), in the subject or body of an email sent from the application (from user Joe) to a customer named Ed: I know how to do this part, but not invisible:

In the Subject:
Plumbing quote [EmailFromLoginName#joeplumber123#EmailToLoginName#EdCustomer456]
OR
In the Body:
Hi Ed,
I would love to get you the plumbing quote you have requested......
...………
at the end of the body if not possible to be invisible.....
DO NOT remove this line below when you reply to the email
[EmailFromLoginName#joeplumber123#EmailToLoginName#EdCustomer456]

When I receive the email, I wish to "search and pluck out" the above string (the part encoded with the # symbols), either from the subject or body, create a record in a BO (call that UserMessages), and then use that BO record to send out another email. I know how to receive incoming emails, and I know how to create a record in the BO from them using the subject, body, etc. So I think I just need to know the "search and pluck and SET" piece. I am thinking that I can use the SET piece to create the record for me, which I can then pass as an input to a process which will then create a reply to Joe from Ed.

Dave
Jaymer
Posts: 2446
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: Using the SET action for incoming emails

Post by Jaymer »

unsure you need set, per THIS THREAD ABOUT SET

If you control the "hidden" string you are embedding in an email, you don't need set, because you can parse the string and you always know its "From X to Y" so its easy to extract the vars.
One easy additional thing would be to build your string "10010:21349" where 10010 represents the "from" and 21349 the "to" and then encyrpt it so no one can monkey with it. Those #s can be the exact Aware/SQL ID Key value so you can FIND the exact record by ID.

Do a FIND on each key value and make sure SEARCH COUNT = 1 or else someone monkeyed with the "hidden string".
Those recs should always be found because you built the string. Be sure to Handle a case where your recs aren't found.

oh, and if you sent it in HTML, you hide it by coloring foreground color = background. Its there and can be selected if they hunt for it - but it would still say "Don't alter this: 10010:21349"
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.

Jaymer
Aware Programming & Consulting - Tampa FL
ddumas
Posts: 389
Joined: Tue Apr 23, 2013 11:17 pm

Re: Using the SET action for incoming emails

Post by ddumas »

Jaymer,

Those suggestions sound great, a few questions:

I am thinking that I cannot put the string in the body of the email, because when someone replies, I would lose the body of the original email. So, I think that I must append the string in the subject line. The subject line would be retained across all send-reply-send email exchanges, but the body is not. As emails are replied to, I can use the nnnn:nnnn ID approach as you suggest, and then build another string to append to the "Base" subject line.

Do I set the entire email to HTML? - I will look for that setting.
If I need just the string portion of the subject line hidden, how would I do that? I am not an HTML guy unfortunately.

If I wanted to, how do you encyrpt the string? Is that through AwareIM, or HTML?

Thanks,

Dave
Post Reply