- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2016 09:57 AM
In order to have a more flexible filter, you will probably need to add custom script that returns true or false based on some regex.
For your ASIA domain example:
var re = /asia$/i; // matches 'asia' at the end of string, case insensitive
return !re.match(email.origemail); // return false if email address matches
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2016 12:28 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2016 12:54 PM
It should, though I am not positive about the field name of the Sender email address (I guessed origemail because that is what it is in other Email Scripts) but also, in these condition scripts, you don't return the answer but set the magic variable "answer" to whether or not you want to allow the email past your filter.
Additionally, you'll probably want to add to this list in the future, so you should write for that eventuality now, as opposed to later.
Try this:
// add to this list as necessary
var filters = [
/asia$/i
];
var answer = true; // allow email
// this field could be different
var field_to_check = email.origemail;
for (var i = 0; i < filters.length; i++) {
if (filters[i].match(field_to_check)) {
// we hit a filter, mark the answer as FALSE
// to disallow this email from going past
answer = false;
}
}
Best of luck,
Andy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2016 12:59 PM
That's a great solution! I will try it.
We started getting lot of spams lately and it would great to add them in an array and block.
Thanks!
Shalini
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2016 07:47 AM
Thanks Andrew! I do not see the option to mark it as the 'Correct Answer'. It helped me block this domain.