| | |
| | | return ResponseEntity.ok(sendMsgService.sendMsgBySMS(toMobile, content)); |
| | | } |
| | | |
| | | @GetMapping("/byEmail") |
| | | public ResponseEntity<String> byEmail( |
| | | @RequestParam String from, |
| | | @RequestParam String to, |
| | | @RequestParam String subject, |
| | | @RequestParam String content, |
| | | @RequestParam boolean htmlFormat |
| | | ) { |
| | | return ResponseEntity.ok(sendMsgService.sendMsgByEmail(from, to, subject, content, htmlFormat)); |
| | | } |
| | | // @GetMapping("/byEmail") |
| | | // public ResponseEntity<String> byEmail( |
| | | // @RequestParam String from, |
| | | // @RequestParam String to, |
| | | // @RequestParam String subject, |
| | | // @RequestParam String content, |
| | | // @RequestParam boolean htmlFormat |
| | | // ) { |
| | | // return ResponseEntity.ok(sendMsgService.sendMsgByEmail(from, to, subject, content, htmlFormat)); |
| | | // } |
| | | // |
| | | // @GetMapping("/byHtmlEmail") |
| | | // public ResponseEntity<String> byHtmlEmail( |
| | | // @RequestParam String from, |
| | | // @RequestParam String to |
| | | // ) { |
| | | // return ResponseEntity.ok(testSendMsgByHtmlTemplateEmail(from, to)); |
| | | // } |
| | | |
| | | @GetMapping("/byHtmlEmail") |
| | | public ResponseEntity<String> byHtmlEmail( |
| | | @RequestParam String from, |
| | | @RequestParam String to |
| | | ) { |
| | | return ResponseEntity.ok(testSendMsgByHtmlTemplateEmail(from, to)); |
| | | } |
| | | |
| | | private String testSendMsgByHtmlTemplateEmail(String from, String to) { |
| | | Context context = new Context(); |
| | | context.setVariable("content", "親愛的顧問您好,您有一筆來自保誠媒合平台的新預約單\n"); |
| | | context.setVariable("urlHint", appointmentService.getAppointmentDetailUrl(0L)); |
| | | |
| | | String content = springTemplateEngine.process("mail/appointmentNotifyEmail", context); |
| | | return sendMsgService.sendMsgByEmail(from, to, NOTIFY_EMAIL_SUBJECT, content, true); |
| | | } |
| | | // private String testSendMsgByHtmlTemplateEmail(String from, String to) { |
| | | // Context context = new Context(); |
| | | // context.setVariable("content", "親愛的顧問您好,您有一筆來自保誠媒合平台的新預約單\n"); |
| | | // context.setVariable("urlHint", appointmentService.getAppointmentDetailUrl(0L)); |
| | | // |
| | | // String content = springTemplateEngine.process("mail/appointmentNotifyEmail", context); |
| | | // return sendMsgService.sendMsgByEmail(from, to, NOTIFY_EMAIL_SUBJECT, content, true); |
| | | // } |
| | | } |