Skip to content

Commit 60ea8ea

Browse files
committed
emil test
1 parent 081e855 commit 60ea8ea

3 files changed

Lines changed: 79 additions & 3 deletions

File tree

src/main/java/com/rui/pro1/common/utils/converter/ResponseNullUtil.java

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
public class ResponseNullUtil extends ObjectMapper {
1212
private static final long serialVersionUID = 1L;
13+
1314
//
1415
public ResponseNullUtil() {
1516
// 空值处理为空串
@@ -34,8 +35,19 @@ public void serialize(Object value, JsonGenerator jg,
3435
// // 数字也加引号
3536
// this.configure(JsonGenerator.Feature.WRITE_NUMBERS_AS_STRINGS, true);
3637
// this.configure(JsonGenerator.Feature.QUOTE_NON_NUMERIC_NUMBERS, true);
37-
38-
39-
38+
// // 进行HTML解码。
39+
// this.registerModule(new SimpleModule().addSerializer(String.class, new
40+
// JsonSerializer<String>(){
41+
// @Override
42+
// public void serialize(String value, JsonGenerator jgen,
43+
// SerializerProvider provider) throws IOException,
44+
// JsonProcessingException {
45+
// jgen.writeString(StringEscapeUtils.unescapeHtml4(value));
46+
// }
47+
// }));
48+
// // 设置时区
49+
// this.setTimeZone(TimeZone.getDefault());//getTimeZone("GMT+8:00")
50+
// // 设置输入时忽略在JSON字符串中存在但Java对象实际没有的属性
51+
// this.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
4052

4153
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.rui.pro1.a;
2+
3+
public class JsonMain {
4+
5+
public static void main(String[] args) {
6+
7+
// JSONObject jobg = new JSONObject();
8+
9+
// 创建JSONObject 对象
10+
}
11+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
package com.rui.pro1.email;
2+
3+
import org.apache.commons.mail.DefaultAuthenticator;
4+
import org.apache.commons.mail.Email;
5+
import org.apache.commons.mail.EmailException;
6+
import org.apache.commons.mail.SimpleEmail;
7+
import org.junit.Test;
8+
9+
public class SimpleEmailTest {
10+
11+
public static void main(String[] args) throws EmailException {
12+
Email email = new SimpleEmail();
13+
email.setHostName("smtp.126.com");
14+
email.setSmtpPort(25);
15+
16+
// email.setHostName("smtp.googlemail.com");
17+
// email.setSmtpPort(465);@126.com
18+
email.setAuthenticator(new DefaultAuthenticator("rui_dev", "ruidev123456"));
19+
email.setSSLOnConnect(true);
20+
//ruidev123456
21+
22+
email.setFrom("rui_dev@126.com");
23+
email.setSubject("TestMail");
24+
25+
email.setMsg("This is a test mail ... :-)");
26+
email.addTo("liangrui_1988@126.com");//1067165280@qq.com
27+
email.send();
28+
System.out.println("xxx");
29+
}
30+
31+
@Test
32+
public void test1() throws EmailException{
33+
Email email = new SimpleEmail();
34+
email.setHostName("pop.126.com ");
35+
email.setSmtpPort(110);
36+
email.setSslSmtpPort("110");
37+
38+
// email.setHostName("smtp.googlemail.com");
39+
// email.setSmtpPort(465);
40+
email.setAuthenticator(new DefaultAuthenticator("rui_dev@126.com", "rui_dev123456"));
41+
email.setSSLOnConnect(true);
42+
43+
44+
email.setFrom("1067165280@qq.com");
45+
email.setSubject("TestMail");
46+
47+
email.setMsg("This is a test mail ... :-)");
48+
email.addTo("382453602@qq.com");
49+
email.send();
50+
51+
}
52+
53+
}

0 commit comments

Comments
 (0)