package {{basePackage}}.utils.mail;

import cn.hutool.extra.mail.MailAccount;
import cn.hutool.extra.mail.MailUtil;

import javax.annotation.Resource;

/**
 * dcrenl: 2023-09-07 14:56:27
 * 邮件处理
 */
public class MailUtils {

    public static MailConfig config = new MailConfig();

    private static MailAccount account = new MailAccount();
    ;

    public MailUtils() {
        account.setHost(config.getHost());
        account.setPort(config.getPort());
        account.setAuth(true);
        account.setFrom(config.getFrom());
        account.setUser(config.getUser());
        account.setPass(config.getPass());
    }

    public static void send(String to, String subject, String content, Boolean isHtml) {

        MailUtil.send(account, to, subject, content, isHtml);
    }
}
