danyuzhu11

只有正文没有附件

 

public void fun() throws MessagingException, IOException{

Session session=MailUtils.createSession("smtp.163.com", "danyuzhu11@163.com", "DANYU1122");
Mail mail=new Mail("danyuzhu11@163.com","494281423@qq.com,904013447@qq.com","这是主题","这是正文");

MailUtils.send(session, mail);
}

 

---------------------------------------------------------------------------------------------------------------

正文+附件

 

@Test
public void fun2() throws MessagingException, IOException{

Session session=MailUtils.createSession("smtp.163.com", "danyuzhu11@163.com", "DANYU1122");
Mail mail=new Mail("danyuzhu11@163.com","494281423@qq.com,904013447@qq.com","这是主题--包含附件","这是正文,卡卡卡");
AttachBean attachBean=new AttachBean(new File("D:/logo.png"),"赵小贱.png");

mail.addAttach(attachBean);
MailUtils.send(session, mail);
}

分类:

技术点:

相关文章:

  • 2021-05-21
  • 2022-12-23
  • 2021-07-30
  • 2022-01-06
  • 2021-11-11
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-07-24
  • 2021-12-10
  • 2022-01-05
相关资源
相似解决方案