邮件发送

1、配置文件

文件位置:dodo_framework_config.properties

dodo.mailsender.smtpHost=smtp.exmail.qq.com
dodo.mailsender.smtpPort=25
dodo.mailsender.smtpUsername=admin@bydodo.com
dodo.mailsender.smtpPassword=123456
dodo.mailsender.smtpCompanyName=Dodo Framework
dodo.mailsender.smtpFromMail=admin@bydodo.com

2、使用

    //依赖注入MailService,然后使用提供的方法

    @Autowired
    private MailService mailService;

3、MailService


public interface MailService {
    // 单人发送模板邮件
    void sendMail(String subject, String templateFilePath, Map<String, Object> data, String toMail)
            throws TemplateException, MessagingException, IOException;

    // 单人发送邮件
    void sendMail(String subject, String msgContent, String toMail) throws MessagingException,
            UnsupportedEncodingException;

    // 多人发送模板邮件
    void sendMail(String subject, String templateFilePath, Map<String, Object> data, String[] toMail)
            throws IOException, TemplateException, MessagingException;

    // 多人发送邮件
    void sendMail(String subject, String msgContent, String[] toMail) throws MessagingException,
            UnsupportedEncodingException;
}
Copyright © DodoFramework 2020 all right reservedModify At: 2019-12-16 13:17:24