public static void main(String[] args) { Mail mail = new Mail(); EmailBuilder emailBuilder = new EmailBuilder(EmailProvider.NetEase_163) .from(System.getenv("from")) .token(System.getenv("token")) .to(System.getenv("to")) .content("Say something") .title("Welcome Letter"); mail.sendEmail(emailBuilder); }
@SuppressWarnings("unused") @PostConstruct public void init() throws IOException { String data_path = System.getenv(OPENSHIFT_DATA_DIR); InputStream inputStream = new FileInputStream(data_path + EMAIL_PROPERTIES); Properties properties = new Properties(); properties.load(inputStream); this.host = properties.getProperty("host"); this.from = properties.getProperty("from"); this.username = properties.getProperty("username"); this.password = properties.getProperty("password"); }