Package au.com.cahaya.asas.util.cli

Examples of au.com.cahaya.asas.util.cli.ToEmailOption


    CommandLineParser parser = new GnuParser ();
    Options options = new Options ();
    options.addOption (new HelpOption ());
    FromEmailOption fromOption = new FromEmailOption ();
    options.addOption (fromOption);
    ToEmailOption toOption = new ToEmailOption ();
    options.addOption (toOption);
    options.addOption (new SubjectOption ());
    options.addOption (new FileOption ());
   
    try {
      // parse the command line arguments
      CommandLine line = parser.parse (options, args);

      if (line.hasOption (HelpOption.cValue)) {
        HelpFormatter hf = new HelpFormatter ();
        hf.printHelp (SendMessage.class.toString (), options);
      }
      else {
        File file = null;
        if (line.hasOption (FileOption.cValue)) {
          file = new File (line.getOptionValue (FileOption.cValue));
        }
        InternetAddress from = fromOption.parse (line);
        InternetAddress to = toOption.parse (line);
        String subject = line.getOptionValue (SubjectOption.cValue);
       
        SendMessage sm = new SendMessage ();
        sm.send (from, to, subject, file);
       
View Full Code Here

TOP

Related Classes of au.com.cahaya.asas.util.cli.ToEmailOption

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.