FileDocCategorySizeDatePackage
TestOpenMailRelay.javaAPI DocExample2011Sat Mar 20 14:52:36 GMT 2004None

TestOpenMailRelay

public class TestOpenMailRelay extends Object
TestOpenMailRelay -- send self-returning SPAM to check for relay sites.
author
Ian F. Darwin
version
$Id: TestOpenMailRelay.java,v 1.13 2004/03/20 20:52:35 ian Exp $

Fields Summary
public static final String
RSS_SITE
Where to refer people that find the test messages on their system.
public static final String
MY_TARGET
Where the test messages will be collected.
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)
Driver to parse options and control Sender


	        
	       
		if (args.length == 0) {
			new TestOpenMailRelayGUI().setVisible(true);
		} else {
			for (int i=0; i<args.length; i++) {
				process(args[i]);
			}
		}
	
public static voidprocess(java.lang.String suspect_relay)
Try the given mail server, writing output to System.out

		process(suspect_relay, System.out);
	
public static voidprocess(java.lang.String suspect_relay, java.io.PrintStream pw)
Try the given mail server, writing output to the given PrintStream

		pw.println("processs: trying: " + suspect_relay);
		try {
			// Redirect all output from mail API to the given stream.
			System.setOut(pw);
			System.setErr(pw);
			Sender2 sm = new Sender2(suspect_relay);
			sm.addRecipient("nobody@erewhon.moc");
			sm.setFrom(MY_TARGET);
			sm.setSubject("Testing for open mail relay, see " + RSS_SITE);
			sm.setBody("This mail is an attempt to confirm that site " +
				suspect_relay + "\n" +
				"is in fact an open mail relay site.\n" +
				"For more information on the problem of open mail relays,\n" +
				"please visit site " + RSS_SITE + "\n" +
				"Please join the fight against spam by closing all open mail relays!\n" +
				"If this open relay has been closed, please accept our thanks.\n");
			sm.sendFile();
		} catch (MessagingException e) {
			pw.println(e);
		} catch (Exception e) {
			pw.println(e);
		}