package com.test.Hello.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.FileSystemResource;
import org.springframework.mail.MailMessage;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.MimeMailMessage;
import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.stereotype.Service;
import javax.mail.internet.MimeMessage;
import java.io.File;
@Service
public class HelloService {
//将用户的邮箱的名字注入到username
@Value("${spring.mail.username}")
private String from;
@Autowired
private JavaMailSender mailSender;
public void sayHello()
{
System.out.println("Hello World
Spring boot之邮件发送添加的依赖以及相关的实现
最新推荐文章于 2024-07-25 17:28:38 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)