Package zephyropen.demo

Source Code of zephyropen.demo.HelloGmail

package zephyropen.demo;

import java.util.Enumeration;
import java.util.Properties;

import zephyropen.util.google.SendGmail;

public class HelloGmail {
  public static void main(String[] args) throws Exception {
   
    System.out.println("args: " + args.length);
    System.out.println(getProps());
   
    if(args.length!=2) return;
   
    SendGmail gmail = new SendGmail(args[0], args[1]);
   
    if (gmail.sendMessage("Hello Gmail", getProps(), ".classpath")){
      System.out.println("email sent");
    } else {
      System.out.println("email failed, check your settings");
    }
  }
 
 
  public static String getProps() {
    String out = new String();
    Properties sys = System.getProperties();
    Enumeration<Object>keys = sys.keys();
    while(keys.hasMoreElements()){
      String key = (String) keys.nextElement();
      String value = (String) sys.getProperty(key);
      out += key + " = " + value + "\n";
    }
   
    return out;
  }
}
TOP

Related Classes of zephyropen.demo.HelloGmail

TOP
Copyright © 2018 www.massapi.com. 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.