package org.jeecg.modules.shop.captcha.config;

import cn.hutool.extra.mail.MailAccount;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class EmailConfig {
    
    @Value("${aliyun.email.host}")
    private String host;
    @Value("${aliyun.email.port}")
    private int port;
    @Value("${aliyun.email.ssl}")
    private boolean sslEnable;
    @Value("${aliyun.email.from}")
    private String from;
    @Value("${aliyun.email.user}")
    private String user;
    @Value("${aliyun.email.token}")
    private String token;
    
    @Bean("partner_MailAccount")
    public MailAccount getMailAccount() {
        MailAccount account = new MailAccount();
        account.setHost(host);
        account.setPort(port);
        account.setAuth(true);
        account.setFrom(from);
        account.setUser(user);
        account.setPass(token);
        account.setSslEnable(sslEnable);
        return account;
    }
    
}
