| |
PlexSpamChecker
This library checks email messages for SPAM and viruses. It uses dozens of blackhole lists and Vipul's razors/SpamNet to detect SPAM messages. In addition, it comes with thousands of signatures for detecting viruses.
Java Docs
Java Docs API
FAQ
Frequently asked questions
Price
Email support@plexobject.com to find prices.
Download
Contact support@plexobject.com to order a trial version or price information.
Usage
/**
* @author : PlexObject Solutions, Inc.
*
* <B>CLASS COMMENTS</B>
* Class Name: LocalCheckSpam
* Class Description:
* LocalCheckSpam tests messages for SPAM
*
* Known Bugs:
*
* Invariants:
*
* Modification History
* Initial Date Changes
* SAB 6/8/2002 Created
*/
import com.plexobject.mail.facade.*;
import java.io.*;
import java.net.*;
import java.util.*;
import javax.mail.*;
import javax.mail.event.*;
import javax.mail.internet.*;
import java.rmi.*;
import java.util.*;
import java.text.*;
public class LocalCheckSpam extends Thread {
public static void main(String[] args) {
int rc = 0;
try {
String outfile = null;
String mailbox = null;
for (int i=0; i<args.length; i++) {
if (args[i].equals("-f")) mailbox = args[++i];
}
Properties props = System.getProperties();
Session session = Session.getDefaultInstance(props, null);
URLName urln = null;
Store inStore = null;
if (mailbox == null) {
urln = new URLName("StdinMailbox://");
inStore = new com.plexobject.mail.trans.TransientStore(session, urln);
} else {
File mboxFile = new File(mailbox);
urln = new URLName("mbox://" + mboxFile.getAbsolutePath().replace(
'\\', '/'));
inStore = new com.plexobject.mail.mbox.MboxStore(session, urln);
}
inStore.connect();
Folder inFolder = inStore.getDefaultFolder();
{
try {
if (!inFolder.isOpen()) inFolder.open(Folder.READ_ONLY);
Message[] msgs = inFolder.getMessages();
FetchProfile fp = new FetchProfile();
fp.add(FetchProfile.Item.ENVELOPE);
fp.add(FetchProfile.Item.FLAGS);
fp.add(javax.mail.UIDFolder.FetchProfileItem.UID);
inFolder.fetch(msgs, fp);
System.err.println("Fetched " + msgs.length + " messages");
LocalCheckSpam[] lcs = new LocalCheckSpam[msgs.length];
long start = System.currentTimeMillis();
for (int i=0; i<msgs.length; i++) {
lcs[i] = new LocalCheckSpam(msgs[i]);
lcs[i].start();
}
long sum = 0;
for (int i=0; i<lcs.length; i++) {
lcs[i].join();
sum += lcs[i].elapsed;
}
long elapsed = System.currentTimeMillis() - start;
double avg = sum / lcs.length;
System.out.println("TOTAL THREADS " + lcs.length + ",
AVERAGE RESPONSE " + avg + " MILLIS, MAIN THREAD took " +
elapsed + " MILLIS"); System.out.flush();
} catch (Throwable e) {
e.printStackTrace();
}
}
inStore.close();
} catch (Throwable e) {
e.printStackTrace();
}
System.exit(rc);
}
public LocalCheckSpam(Message m) {
this.message = m;
}
public void run() {
long start = System.currentTimeMillis();
try {
StringBuffer reason = new StringBuffer();
boolean spam = spamChecker.isSpam(message,
IRemoteAntispamService.POLICY_NORMAL, reason);
elapsed = System.currentTimeMillis() - start;
System.out.println("Message with subject " + message.getSubject() +
" SPAM " + spam + " (" + elapsed + " millis) " + reason);
System.out.flush();
} catch (Throwable e) {
elapsed = System.currentTimeMillis() - start;
try {
System.err.println("Message with subject " + message.getSubject() +
" could not be checked in " + elapsed + " MILLIS: " + e);
} catch (MessagingException ex) {}
}
}
private Message message;
private long elapsed;
private static IAntispamService spamChecker = new AntispamServiceImpl();
}
|
|
|
 |
|
 |
Absolutely Free
Following tools are available freely:
- PlexJar
- PlexWhich
- PlexDep
- PlexImports
|
|
 |
 |
Free Trial
Contact us via our Web Form or via Email at
to get free 30-day trial of any of our library and tools.
|
|
 |
 |
|
Contact us via our Web Form or via Email at
if you need assistance installing or using any of our software products. In addition, we welcome any suggestions to improve our products.
|
|
 |
 |
|
Users who are not familiar with Java should download PlexGiffer with VM if it's available on your platform, otherwise download Java from
If you have already installed Java and downloading PlexGiffer without VM, make sure that it is 1.4 or later. Otherwise download Java from http://java.sun.com/j2se freely.
|
|
 |
|