增加项目README.md
This commit is contained in:
@ -17,7 +17,7 @@ import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author : heibaiying
|
||||
* @description :
|
||||
* @description : 邮件发送基本类
|
||||
*/
|
||||
@Component
|
||||
public class SpringMail {
|
||||
|
@ -17,7 +17,7 @@
|
||||
<property name="port" value="587"/>
|
||||
</bean>
|
||||
|
||||
<!--配置模板引擎-->
|
||||
<!--配置beetle模板引擎-->
|
||||
<bean id="resourceLoader" class="org.beetl.core.resource.ClasspathResourceLoader">
|
||||
<!--指定加载模板资源的位置 指定在classpath:beetl下-->
|
||||
<constructor-arg name="root" value="beetl"/>
|
||||
|
@ -29,13 +29,19 @@ public class SendEmail {
|
||||
// 接收方邮箱地址
|
||||
private static final String to = "接收方邮箱地址@qq.com";
|
||||
|
||||
|
||||
/**
|
||||
* 简单邮件测试
|
||||
*/
|
||||
@Test
|
||||
public void sendMessage() {
|
||||
|
||||
springMail.sendTextMessage(from, authWord, to, "spring简单邮件", "Hello Spring Email!");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 发送带附件的邮件
|
||||
*/
|
||||
@Test
|
||||
public void sendComplexMessage() {
|
||||
Map<String, File> fileMap = new HashMap<>();
|
||||
@ -45,12 +51,18 @@ public class SendEmail {
|
||||
, "Hello Spring Email!", fileMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送内嵌资源的邮件
|
||||
*/
|
||||
@Test
|
||||
public void sendEmailWithInline() {
|
||||
springMail.sendEmailWithInline(from, authWord, to, "spring内嵌资源邮件"
|
||||
, "Hello Spring Email!", new File("D:\\LearningNotes\\picture\\RabbitMQ模型架构.png"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送模板邮件
|
||||
*/
|
||||
@Test
|
||||
public void sendEmailByTemplate() {
|
||||
springMail.sendEmailByTemplate(from, authWord, to,
|
||||
|
Reference in New Issue
Block a user