1. Home
  2. Knowledge Base
  3. GMS
  4. How can I prevent SPAM with an MML script?

How can I prevent SPAM with an MML script?

Answer

It is possible to expand the capabilities of the GMS Anti-Spam product by using MML Scripts.

Here is an example of a script which makes it possible to reject messages from various domains, depending upon the content of the subject line.

if (emailX-MMLScript == "")
{
restrictedwordsfile1 = FileOpen("\spamalldomainsrestrictedwords.txt",  FILE_READ);
if (restrictedwordsfile1)
{
while (!FileEof(restrictedwordsfile1))
{
Word1 = FileReadLine(restrictedwordsfile1);
if InStr(emailSubject,Word1)
{
action = 1;
parameter = "550 we do not deliver SPAM";
}
}
}
FileClose(restrictedwordsfile1);

domainsfile = FileOpen("\spamdomains.txt",FILE_READ);
if (domainsfile)
{
while (!FileEof(domainsfile))
{
word2 = FileReadLine(domainsfile);
if InStr(mail,word2)
{
restrictedwordsfile2 = FileOpen("\spamdomainsrestrictedwords.txt",FILE_READ);
if (restrictedwordsfile2)
{
while (!FileEof(restrictedwordsfile2))
{
Word3 = FileReadLine(restrictedwordsfile2);
if InStr(emailSubject,Word3)
{
action = 1;
parameter = "550 we do not deliver SPAM";
}
}
}
FileClose(restrictedwordsfile2);

}
}
}
FileClose(domainsfile);
}

The script requires three files:

  • spamalldomainsrestrictedwords.txt
  • spamdomains.txt
  • spamdomainsrestrictedwords.txt

These files should be placed in the base GMS folder (Usually c:gordano), and should contain the following:

  • spamalldomainsrestrictedwords.txt – words to be reject for all domains
  • spamdomains.txt – the domains to be filtered separately
  • spamdomainsrestrictedwords.txt – the restricted words for the specific domains

See Also:

Keywords:SPAM, MML, prevent

Was this article helpful?

Related Articles

Contents

Need Support?

Can't find the answer you're looking for?
Contact Support