Sending Spam with SWT


import org.eclipse.swt.*;
import org.eclipse.swt.ole.win32.*;
import org.eclipse.swt.widgets.*;

public class Spam {
public static void main(String args[]) {
// Only needed to obtain an OleFrame
Display display = new Display();
Shell shell = new Shell(display);
// Only needed to get a site
OleFrame frame = new OleFrame(shell, SWT.NONE);
OleClientSite site = new OleClientSite(frame, SWT.NONE, "Outlook.Application");
// Activate Outlook
site.doVerb(OLE.OLEIVERB_INPLACEACTIVATE);
OleAutomation outlook = new OleAutomation(site);
OleAutomation mail = invoke(outlook,"CreateItem",0 /*Mail item*/).getAutomation();
setProperty(mail,"To","spam");
setProperty(mail,"BodyFormat",2 /* HTML */);
setProperty(mail,"Subject","Spam freshly made");
setProperty(mail,"HtmlBody","

Spam4U

");
invoke(mail,"Display" /* or "Send" */ );
outlook.dispose();
shell.dispose();
display.dispose();
}
// These helper methods facilitate writing the OLE apps
private static Variant invoke(OleAutomation auto, String command) {
return auto.invoke(property(auto,command));
}
private static Variant invoke(OleAutomation auto, String command, String value) {
return auto.invoke(property(auto,command),
new Variant[] { new Variant(value)});
}
private static Variant invoke(OleAutomation auto, String command, int value) {
return auto.invoke(property(auto,command),
new Variant[] { new Variant(value)});
}
private static boolean setProperty(OleAutomation auto, String name, String value) {
return auto.setProperty(property(auto,name), new Variant(value));
}
private static boolean setProperty(OleAutomation auto, String name, int value) {
return auto.setProperty(property(auto,name), new Variant(value));
}
private static int property(OleAutomation auto, String name) {
return auto.getIDsOfNames(new String[] { name })[0];
}
}

Related posts:

  1. Blog Comment Spam and WordPress Anti-Spam Plugins
  2. Fighting Form Spam with CSS
  3. Top Eclipse Plugins
  4. Top 10 Eclipse Hotkeys
  5. Avoid Spam in Input Forms
  6. Block referer spam easily
  7. Howto: Convert an OpenSSL key to a public/private OpenSSH key-pair
  8. Java and C# Client Server Socket Programming
  9. SSL: Verifying that a Certificate matches a Private Key
  10. MySQL Concatenate: Adding String At The End Of Field Data

Popular Related Items »

Leave a Comment