@@ -28,6 +28,9 @@ public class MailTest {
28
28
@ Autowired
29
29
private JavaMailSenderImpl mailSender ;
30
30
31
+ /**
32
+ * 发送普通邮件(文本)
33
+ */
31
34
@ Test
32
35
public void send (){
33
36
SimpleMailMessage simpleMailMessage = new SimpleMailMessage ();
@@ -40,6 +43,11 @@ public void send(){
40
43
41
44
System .out .println ("mail has been send" );
42
45
}
46
+
47
+ /**
48
+ * 发送html的电子邮件
49
+ * @throws MessagingException
50
+ */
43
51
@ Test
44
52
public void sendHtmlMail () throws MessagingException {
45
53
MimeMessage mimeMessage = mailSender .createMimeMessage ();
@@ -60,7 +68,10 @@ public void sendHtmlMail() throws MessagingException {
60
68
System .out .println ("mail has been send" );
61
69
}
62
70
63
-
71
+ /**
72
+ * 发送含有图片的电子邮件
73
+ * @throws MessagingException
74
+ */
64
75
@ Test
65
76
public void sendAttachedImageMail () throws MessagingException {
66
77
MimeMessage mimeMessage = mailSender .createMimeMessage ();
@@ -85,6 +96,10 @@ public void sendAttachedImageMail() throws MessagingException {
85
96
System .out .println ("mail has been send" );
86
97
}
87
98
99
+ /**
100
+ * 发送含有附件的电子邮件
101
+ * @throws MessagingException
102
+ */
88
103
@ Test
89
104
public void sendAttendedFileMail () throws MessagingException {
90
105
MimeMessage mimeMessage = mailSender .createMimeMessage ();
@@ -108,6 +123,11 @@ public void sendAttendedFileMail() throws MessagingException {
108
123
System .out .println ("mail has been send" );
109
124
110
125
}
126
+
127
+ /**
128
+ * 普通发送的方法,通用
129
+ * @throws MessagingException
130
+ */
111
131
@ Test
112
132
public void sendMail () throws MessagingException {
113
133
Properties properties = new Properties ();
0 commit comments