### Question:
EmailSender { public void sendEmail(SendBoxInfo sendBoxInfo, EmailContent sendContent, String[] to) throws MessagingException, MailException { JavaMailSenderImpl senderImpl = new JavaMailSenderImpl(); senderImpl.setHost(sendBoxInfo.getHost()); senderImpl.setPort(sendBoxInfo.getPort()); senderImpl.setUsername(sendBoxInfo.getUserName()); senderImpl.setPassword(sendBoxInfo.getPwd()); senderImpl.setDefaultEncoding(sendBoxInfo.getDefaultEncoding()); senderImpl.setJavaMailProperties(sendBoxInfo.getProperties()); MimeMessage mimeMessage = senderImpl.createMimeMessage(); MimeMessageHelper helper = new MimeMessageHelper(mimeMessage); helper.setTo(to); helper.setFrom(sendBoxInfo.getFrom()); helper.setSubject(sendContent.getSubject()); helper.setText(sendContent.getContent(), sendContent.isHtml()); senderImpl.send(mimeMessage); logger.debug("邮件发送成功,email:{}", Arrays.toString(to)); }  void sendEmail(SendBoxInfo sendBoxInfo, EmailContent sendContent, String[] to);  }### Answer:
@Test public void testEmailSend() throws MessagingException { SendBoxInfo sendBoxInfo = new SendBoxInfo(); sendBoxInfo.setFrom("syniii@163.com"); sendBoxInfo.setHost("smtp.163.com"); sendBoxInfo.setUserName("syniii"); sendBoxInfo.setPwd("930905"); EmailContent sendContent = new EmailContent(); sendContent.setContent("看看能否收到2"); sendContent.setSubject("邮件收到了么，不行就再试试？"); String[] to = new String[] { "syniii@sogou.com", "hao.yhao@gmail.com" }; emailSender.sendEmail(sendBoxInfo, sendContent, to); }