- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-23-2021 01:18 PM
We are using "Create Incident" email inbound action to create incidents from emails that will be sent out to our instance. Emails will be received from all domains (Gmail, yahoo, outlook etc.). The requirement is to read the email sender's domain and add a work notes based on his/her domain so that support group will know if it came from a known domain or not. Known domains are all the partners that are working with the company (The list is almost over 200).
I am aware that I can use if(email.from.toString().toLowerCase().indexOf('gmail.com')>=0) to read the email domain from the sender email address. Since the known domain list is over 200, how can I compare it with the known domain list what I have to see if the email came from a known domain or not? Any thoughts? Thanks in advance.
Solved! Go to Solution.
- Labels:
-
Integrations
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-21-2021 01:02 PM
I achieved it through below code:
var kDomains = ["abc.com", "xyz.com"];
var kDomains1 = kDomains.toString().split(',');
var count = 1;
for (var x = 0; x < kDomains1.length; x++) {
count++;
if (email.from.toString().toLowerCase().indexOf(kDomains1[x]) >= 0) {
current.work_notes = "[code]<p> <h3 style='color:purple; font size=5;'>" + 'Email from a Known domain'+ "</h3></p>[/code]";
break;
}
}
if (count > kDomains1.length && email.from.toString().toLowerCase().indexOf('<your organization domain') == -1) {
current.work_notes = "[code]<p> <h3 style='color:red; font size=5;'>" + 'Email from unknown domain' + "</h3></p>[/code]";
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-31-2024 05:55 PM
Hello,
What is your solution? I need to do the same.
Thanks,
Chad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-23-2021 01:53 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2021 02:39 AM
Hello mnreddy,
You can define sender's domain in email properties go to Inbound Email Configuration.
You can mention all domains.
Hope this helps.
Thanks,
Laxmi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-21-2021 01:02 PM
I achieved it through below code:
var kDomains = ["abc.com", "xyz.com"];
var kDomains1 = kDomains.toString().split(',');
var count = 1;
for (var x = 0; x < kDomains1.length; x++) {
count++;
if (email.from.toString().toLowerCase().indexOf(kDomains1[x]) >= 0) {
current.work_notes = "[code]<p> <h3 style='color:purple; font size=5;'>" + 'Email from a Known domain'+ "</h3></p>[/code]";
break;
}
}
if (count > kDomains1.length && email.from.toString().toLowerCase().indexOf('<your organization domain') == -1) {
current.work_notes = "[code]<p> <h3 style='color:red; font size=5;'>" + 'Email from unknown domain' + "</h3></p>[/code]";
}