mirror of
https://github.com/dromara/RuoYi-Vue-Plus.git
synced 2025-09-24 07:19:46 +08:00
Compare commits
23 Commits
a703cb2ad1
...
v5.4.2
| Author | SHA1 | Date | |
|---|---|---|---|
| fd5d028e95 | |||
| 64100cf1ff | |||
| 7e7d857ba5 | |||
| d22b2a10df | |||
| 957a4d1fcd | |||
| 49ef8378fe | |||
| 57dd6831d3 | |||
| 8aa60abb1f | |||
| 7a9f51fc7a | |||
| 159e30c982 | |||
| 7334d91d6b | |||
| 95c01301f6 | |||
| 296466fa13 | |||
| 3c8d864b5f | |||
| ea50a57602 | |||
| 7e14b98676 | |||
| 015b406001 | |||
| 098d3347a0 | |||
| 08d4493994 | |||
| 367d739e2d | |||
| d6688a367d | |||
| 0b331796e2 | |||
| 456620b638 |
@ -1,6 +1,5 @@
|
||||
package org.dromara.demo.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.mail.utils.MailUtils;
|
||||
@ -18,7 +17,6 @@ import java.util.Arrays;
|
||||
*
|
||||
* @author Michelle.Chung
|
||||
*/
|
||||
@SaIgnore
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@ -44,11 +42,11 @@ public class MailController {
|
||||
* @param to 接收人
|
||||
* @param subject 标题
|
||||
* @param text 内容
|
||||
* @param filePath 附件路径
|
||||
*/
|
||||
@GetMapping("/sendMessageWithAttachment")
|
||||
public R<Void> sendMessageWithAttachment(String to, String subject, String text, String filePath) {
|
||||
MailUtils.sendText(to, subject, text, new File(filePath));
|
||||
public R<Void> sendMessageWithAttachment(String to, String subject, String text) {
|
||||
// 附件路径 禁止前端传递 有任意读取系统文件风险
|
||||
MailUtils.sendText(to, subject, text, new File("/xxx/xxx"));
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@ -58,10 +56,11 @@ public class MailController {
|
||||
* @param to 接收人
|
||||
* @param subject 标题
|
||||
* @param text 内容
|
||||
* @param paths 附件路径
|
||||
*/
|
||||
@GetMapping("/sendMessageWithAttachments")
|
||||
public R<Void> sendMessageWithAttachments(String to, String subject, String text, String[] paths) {
|
||||
public R<Void> sendMessageWithAttachments(String to, String subject, String text) {
|
||||
// 附件路径 禁止前端传递 有任意读取系统文件风险
|
||||
String[] paths = new String[]{"/xxx/xxx", "/xxx/xxx"};
|
||||
File[] array = Arrays.stream(paths).map(File::new).toArray(File[]::new);
|
||||
MailUtils.sendText(to, subject, text, array);
|
||||
return R.ok();
|
||||
|
||||
Reference in New Issue
Block a user