| | |
| | | URLEncoder.encode(fromEmail, "UTF-8"), URLEncoder.encode(fromEmailPwd, "UTF-8"), |
| | | URLEncoder.encode(toEmail, "UTF-8"), URLEncoder.encode(title, "UTF-8"), |
| | | URLEncoder.encode(content, "UTF-8")); |
| | | System.out.println(url); |
| | | String result = HttpUtil.get(url); |
| | | JSONObject data = JSONObject.fromObject(result); |
| | | if (data.optInt("code") == 0) |
| | |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | String username = "kuaisheng110@163.com"; |
| | | String pwd = "CMZASWUPTJSFXCNP"; |
| | | MailSendInfo mailInfo = new MailSendInfo(); |
| | | mailInfo.setMailServerHost("smtp." + username.split("@")[1]); |
| | | mailInfo.setMailServerPort("25"); |
| | | mailInfo.setValidate(true); |
| | | |
| | | mailInfo.setUserName(username); |
| | | mailInfo.setPassword(pwd); |
| | | mailInfo.setFromAddress(username); |
| | | mailInfo.setToAddress("hexiaohui@banliapp.com"); |
| | | mailInfo.setSubject("测试发送标题"); |
| | | StringBuffer buffer = new StringBuffer(); |
| | | buffer.append("测试发送内容"); |
| | | mailInfo.setContent(buffer.toString()); |
| | | sendTextMail(mailInfo); |
| | | String fromEmail="ohaicao@163.com"; |
| | | String fromEmailPwd="admin123456"; |
| | | String title="测试标题"; |
| | | String content="测试内容"; |
| | | sendEmail("liuhongrui@banliapp.com",fromEmail,fromEmailPwd,title,content); |
| | | } |
| | | } |