import jar package
<!-- jfinal邮件插件 -->
<dependency>
<groupId>cn.fsdev</groupId>
<artifactId>jfinal-mail-plugin</artifactId>
<version>2.2</version>
</dependency>
<!-- jfinal-mailer -->
<dependency>
<groupId>cn.dreampie</groupId>
<artifactId>jfinal-mailer</artifactId>
<version>0.2</version>
</dependency>
Configure plugins in the general configuration file
// 邮件插件
me.add(new MailerPlugin("mail.properties"));
properties file configuration
#邮箱HOST
smtp.host=smtp.163.com
#端口
smtp.port=25
#发送邮箱
[email protected]
#用户名
[email protected]
#密码(要设置授权密码)
smtp.password=
NetEase mailbox port number
Set up authorization code
send email
//发送普通邮件
Mailer.sendHtml("测试标题", "<a href='www.dreampie.cn'>测试内容</a>", "[email protected]");
There are also methods for sending plain text and pending attachments in the Mailer class, which are not listed here.
First address: https://my.oschina.net/u/3639290/blog/1624046