Skip to content

Commit 30a53bb

Browse files
note
1 parent 7ed3cf0 commit 30a53bb

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/test/java/com/example/MailTest.java

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ public class MailTest {
2828
@Autowired
2929
private JavaMailSenderImpl mailSender;
3030

31+
/**
32+
* 发送普通邮件(文本)
33+
*/
3134
@Test
3235
public void send(){
3336
SimpleMailMessage simpleMailMessage = new SimpleMailMessage();
@@ -40,6 +43,11 @@ public void send(){
4043

4144
System.out.println("mail has been send");
4245
}
46+
47+
/**
48+
* 发送html的电子邮件
49+
* @throws MessagingException
50+
*/
4351
@Test
4452
public void sendHtmlMail() throws MessagingException {
4553
MimeMessage mimeMessage = mailSender.createMimeMessage();
@@ -60,7 +68,10 @@ public void sendHtmlMail() throws MessagingException {
6068
System.out.println("mail has been send");
6169
}
6270

63-
71+
/**
72+
* 发送含有图片的电子邮件
73+
* @throws MessagingException
74+
*/
6475
@Test
6576
public void sendAttachedImageMail() throws MessagingException {
6677
MimeMessage mimeMessage = mailSender.createMimeMessage();
@@ -85,6 +96,10 @@ public void sendAttachedImageMail() throws MessagingException {
8596
System.out.println("mail has been send");
8697
}
8798

99+
/**
100+
* 发送含有附件的电子邮件
101+
* @throws MessagingException
102+
*/
88103
@Test
89104
public void sendAttendedFileMail() throws MessagingException {
90105
MimeMessage mimeMessage = mailSender.createMimeMessage();
@@ -108,6 +123,11 @@ public void sendAttendedFileMail() throws MessagingException {
108123
System.out.println("mail has been send");
109124

110125
}
126+
127+
/**
128+
* 普通发送的方法,通用
129+
* @throws MessagingException
130+
*/
111131
@Test
112132
public void sendMail() throws MessagingException {
113133
Properties properties = new Properties();

0 commit comments

Comments
 (0)