发送带附件的邮件,显示发送成功,但是邮件里和垃圾桶都看不到
发送带附件的邮件,显示发送成功,但是邮件里和垃圾桶都看不到,不知道怎么处理。
//携带邮件附件 public void sendAttachmentsMail(String to,String subject,String content,String filePath) throws MessagingException { MimeMessage message = mailSender.createMimeMessage(); //如果需要带上附件,请写true MimeMessageHelper messageHelper = new MimeMessageHelper(message,true); messageHelper.setFrom(from); messageHelper.setTo(to); messageHelper.setText(content,true ); messageHelper.setSubject(subject); FileSystemResource fileSystemResource = new FileSystemResource(new File(filePath)); String filename = fileSystemResource.getFilename(); messageHelper.addAttachment(filename,fileSystemResource); mailSender.send(message); }