package com.yifu.cloud.plus.v1.mail.service.impl;

import com.yifu.cloud.plus.v1.mail.entity.Email;
import com.yifu.cloud.plus.v1.mail.service.MailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Service;

/**
 * @Author fxj
 * @Description 邮件发送服务
 * @Date 17:41 2022/12/1
**/
@Service("mailService")
public class MailServiceImpl  implements MailService {
	@Autowired
	private JavaMailSender mailSender;

	@Override
	public Boolean sendMail(Email email) {
		SimpleMailMessage mailMessage = new SimpleMailMessage();
		mailMessage.setFrom("information@wanxin-holdings.com");
		mailMessage.setTo("fangxinjiang@wanxin-holdings.com");
		mailMessage.setText("你好 hello world");
		mailMessage.setSubject("测试Spring邮箱服务");
		mailSender.send(mailMessage);
		System.out.println("====完成发送！====");
		return null;
	}
}
