Commit cedbdd12 authored by fangxinjiang's avatar fangxinjiang

邮件服务

parent fb44737d
package com.yifu.cloud.plus.v1.mail.entity;
import lombok.Data;
/**
* @Author fxj
* @Date 2022/12/8
* @Description
* @Version 1.0
*/
@Data
public class Email {
private String[] user;
private String subject;
private String content;
}
package com.yifu.cloud.plus.v1.mail.service;
import com.sun.xml.internal.ws.resources.SenderMessages;
import com.yifu.cloud.plus.v1.mail.entity.Email;
/**
* @Author fxj
......@@ -11,6 +12,6 @@ import com.sun.xml.internal.ws.resources.SenderMessages;
**/
public interface MailService {
Boolean sendMail(SenderMessages messages);
Boolean sendMail(Email email);
}
package com.yifu.cloud.plus.v1.mail.service.impl;
import com.sun.xml.internal.ws.resources.SenderMessages;
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;
......@@ -18,9 +18,9 @@ public class MailServiceImpl implements MailService {
private JavaMailSender mailSender;
@Override
public Boolean sendMail(SenderMessages messages) {
public Boolean sendMail(Email email) {
SimpleMailMessage mailMessage = new SimpleMailMessage();
mailMessage.setFrom("fangxinjiang@wanxin-holdings.com");
mailMessage.setFrom("information@wanxin-holdings.com");
mailMessage.setTo("fangxinjiang@wanxin-holdings.com");
mailMessage.setText("你好 hello world");
mailMessage.setSubject("测试Spring邮箱服务");
......
......@@ -10,12 +10,19 @@ spring:
host: 127.0.0.1
password: '@yf_2017'
mail:
host: smtp.wanxin-holdings.com
host: smtp.exmail.qq.com
port: 465
username: information@wanxin-holdings.com
password: QmdCaQSPmCAQEddd
protocol: smtp
default-encoding: UTF-8
properties:
mail.smtp.auth: true
mail.smtp.starttls.enable: true
mail.smtp.starttls.required: true
mail.smtp.socketFactory.port: 465
mail.smtp.socketFactory.class: javax.net.ssl.SSLSocketFactory
mail.smtp.socketFactory.fallback: false
datasource:
type: com.zaxxer.hikari.HikariDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
......@@ -44,4 +51,5 @@ security:
urls:
- /v3/api-docs
- /actuator/**
- /swagger-ui/**
\ No newline at end of file
- /swagger-ui/**
- /sendMail/**
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment