How do I properly capture a string in an email body?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2022 10:20 PM
Hi,
In an inbound email, the email template contains "Process the request from test@test.com". I need to capture the email.
I have the code "var reqEmail = email.body.process_the_request_from" and have it set to the short description but it's returning undefined.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2022 10:59 PM
Hi,
Use the below logic.
var template = "Process the request from test@test.com";
var splitStr= template.split('from'); ['Process the request from', 'test@test.com']
var emailAdd = splitStr[1]; //test@test.com
You can add this emailAdd to the description on any other fields in your table.
Mark this as Correct/Helpful in case this helps you in anyways.
Regards,
Sourabh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2022 11:17 PM
Hi Sourabh,
I tried your codes above but it did also captured the remaining texts of the email body.
var str = email.body_text;
var splitReqEmail = str.split('from');
var reqEmail = splitReqEmail[1];

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2022 11:25 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2022 11:42 PM
Hi,
Yep, this will work because it's a specified variable for the whole string. For my case, I have the whole email.body_text that contains other information apart from ['Process the request from', 'test@test.com'] That's why it's still capturing texts after the email part.