FileDocCategorySizeDatePackage
MailClient.javaAPI DocExample628Fri Feb 03 16:13:12 GMT 2006None

MailClient

public class MailClient extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)


    if (args.length == 0) {
      System.err.println("Usage: java MailClient username@host.com");
      return;
    }
    
    try {
      URL u = new URL("mailto:" + args[0]);
      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);
    }