Commit 89888c6c authored by 赵建伟's avatar 赵建伟

upadte codes

parent b4873e4b
......@@ -120,7 +120,7 @@
<workItem from="1588154352798" duration="195000" />
<workItem from="1588220085338" duration="7993000" />
<workItem from="1588248522289" duration="2820000" />
<workItem from="1588344251422" duration="1726000" />
<workItem from="1588344251422" duration="1793000" />
</task>
<task id="LOCAL-00001" summary="add init codes.">
<created>1587723565207</created>
......
......@@ -216,7 +216,7 @@
<workItem from="1588148891822" duration="2318000" />
<workItem from="1588152718016" duration="1463000" />
<workItem from="1588154601852" duration="28557000" />
<workItem from="1588344252163" duration="3149000" />
<workItem from="1588344252163" duration="3401000" />
</task>
<servers />
</component>
......
......@@ -9,6 +9,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ServiceServerApplication {
public static void main(String[] args) {
System.setProperty("mail.mime.splitlongparameters", "false");
SpringApplication.run(ServiceServerApplication.class, args);
}
}
......@@ -15,6 +15,7 @@ import org.springframework.stereotype.Component;
import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeUtility;
import java.io.File;
......@@ -48,7 +49,8 @@ public class EmailServiceImpl implements EmailService {
MimeMessage message = mailSender.createMimeMessage();
try {
MimeMessageHelper helper = new MimeMessageHelper(message, true);
//MimeMessageHelper helper = new MimeMessageHelper(message, true);
MimeMessageHelper helper = new MimeMessageHelper(message, true,"UTF-8");
helper.setFrom(from);
String[] toUsers = to.split(",");
helper.setTo(toUsers);
......@@ -64,9 +66,10 @@ public class EmailServiceImpl implements EmailService {
String fileNameSrc = name + "-" + DateUtils.getCurrentDateSimpleStr() + ".xlsx";
FileSystemResource file = new FileSystemResource(new File(filePath + fileNameSrc));
helper.addAttachment(fileName, file);
helper.addAttachment(MimeUtility.encodeWord(file.getFilename(),"utf-8","B"), file);
mailSender.send(message);
logger.info("带附件的邮件已经发送。");
} catch (MessagingException e) {
} catch (Exception e) {
logger.error("发送带附件的邮件时发生异常!", e);
rs = Constants.FAIL;
}
......
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