日期:2014-05-17 浏览次数:21072 次
HtmlEmail email = new HtmlEmail(); email.setHostName("192.168.1.123");//服务器 email.setSmtpPort(25); email.addTo("bcrcw@test.cn");//设置接收方 email.setFrom("782213194@qq.com");//设置发送方 email.getMailSession().getProperties().put("mail.smtp.auth", "false"); email.setCharset("UTF-8");//设置编码 email.setSubject("你好"); email.setHtmlMsg("<html><body>hello</body></html>"); email.setPopBeforeSmtp(true,"test.cn","bcrcw","123456"); if(!email.send().isEmpty()){ System.out.println("success"); }else{ System.out.println("error"); }