import java.io.IOException; import java.io.OutputStream; import java.net.URL; import java.net.URLConnection; public class MainClass { public static void main(String[] args) { try { URL u = new URL("mailto:your@yourserver.net"); URLConnection uc = u.openConnection(); uc.setDoOutput(true); uc.connect(); OutputStream out = uc.getOutputStream(); for (int c = System.in.read(); c != -1; c = System.in.read()) { out.write(c); } out.close(); } catch (IOException ex) { System.err.println(ex); } } }