private void sendEmail(String from, String to, String subject, String message) { SimpleMailMessage mailMessage = new SimpleMailMessage(); mailMessage.setFrom(from); mailMessage.setTo(to.split(",")); mailMessage.setSubject(subject); mailMessage.setText(message); mailSender.send(mailMessage); }
/** This method will send compose and send the message */ public void sendMail(String to, String subject, String body) { SimpleMailMessage message = new SimpleMailMessage(); message.setTo(to); message.setSubject(subject); message.setText(body); mailSender.send(message); }
/** * Send a simple message with pre-populated values. * * @param msg the message to send * @throws org.springframework.mail.MailException when SMTP server is down */ public void send(SimpleMailMessage msg) throws MailException { try { mailSender.send(msg); } catch (MailException ex) { log.error(ex.getMessage()); throw ex; } }
/** * Send a simple message with pre-populated values. * * @param msg */ public void send(SimpleMailMessage msg) { try { mailSender.send(msg); } catch (MailException ex) { // log it and go on log.error(ex.getMessage()); } }
private void sendUpgradeEMail(User user) { SimpleMailMessage mailMessage = new SimpleMailMessage(); mailMessage.setTo(user.getEmail()); mailMessage.setFrom("*****@*****.**"); mailMessage.setSubject("Upgrade 안내"); mailMessage.setText("사용자의 등급이 " + user.getLevel().name() + "로 업그레이드 되었습니다."); mailSender.send(mailMessage); }
public void sendMail(String from, String to, String subject, String msg) { SimpleMailMessage message = new SimpleMailMessage(); System.out.println("inside mail sendmail"); message.setFrom(from); message.setTo(to); message.setSubject(subject); message.setText(msg); mailSender.send(message); }
@RequestMapping("/sendQuote.htm") public void sendQuote( @RequestParam String name, @RequestParam String email, @RequestParam String message) { SimpleMailMessage mail = new SimpleMailMessage(); templateMessage.copyTo(mail); mail.setTo("*****@*****.**"); mail.setSubject("Quote from Qash site [" + name + "]"); mail.setText("From: " + name + "(" + email + ")\n\n" + mail); mailSender.send(mail); // return "redirect:/index.htm"; }
@Override protected void doNotify(ClientApplicationStatusChangedEvent event) { EvaluationContext context = new StandardEvaluationContext(event); SimpleMailMessage message = new SimpleMailMessage(); message.setTo(to); message.setFrom(from); message.setSubject(subject.getValue(context, String.class)); message.setText(text.getValue(context, String.class)); message.setCc(cc); sender.send(message); }
public void sendEmailNotification(String from, String to) { try { logger.info("Sending email to " + to); SimpleMailMessage message = new SimpleMailMessage(); message.setFrom("OnionSquare Registration <*****@*****.**>"); message.setTo(to); message.setSubject("Onionsquare | No Sales Activity Email Notification"); message.setText( "We have noticed no sales activity of your store since 5 months. We suggest you to take appropriate actions to continue your store. Your store will be deactivated after one months of this email if we notice no sales of your store during this period. Thank you."); logger.info("Sending no sales activity email notification to " + to); mailSender.send(message); logger.info("Email sent to" + to); } catch (Exception e) { logger.info("Mail cannot be send due to internal error"); } }
@RequestMapping( value = "/sendmessage", method = RequestMethod.POST, produces = "application/json") @ResponseBody public Map<String, Object> sendMessages( Principal principal, @RequestBody Map<String, Object> data) { String text = (String) data.get("text"); String name = (String) data.get("name"); String email = (String) data.get("email"); // String username= (String)data.get("username"); User msgSender = usersService.getUserByEmail(email); String username = msgSender.getUsername(); // Integer target= (Integer)data.get("target"); Message message = new Message(); message.setName(principal.getName()); // siuntejo message.setUsername(username); // Gavejo message.setEmail(email); message.setContent(text); message.setSubject("Reply from: " + name); System.out.println(name + " " + email + " " + text); SimpleMailMessage mail = new SimpleMailMessage(); mail.setFrom("*****@*****.**"); mail.setTo(email); mail.setSubject("Reply from: " + name); mail.setText(text); usersService.sendMessage(message); try { mailSender.send(mail); } catch (Exception e) { e.printStackTrace(); System.out.println("Cant send"); } Map<String, Object> reply = new HashMap<String, Object>(); reply.put("success", true); // reply.put("target", target); return reply; }
public void sendMail( String fromEmail, String toEmail, String ccEmail, String subject, String body) throws MailException { SimpleMailMessage message = new SimpleMailMessage(); message.setFrom(fromEmail); message.setTo(toEmail); if (StringUtils.isNotEmpty(ccEmail)) { message.setCc(ccEmail); } message.setSubject(subject); message.setText(body); try { mailSender.send(message); System.out.println("Mail sent"); } catch (MailException e) { e.printStackTrace(); System.out.println("Mail failed"); throw e; } }
public void sendMail(User user, String email, String subject, String templateUrl) throws Exception { SimpleMailMessage message = new SimpleMailMessage(); String hostname = InetAddress.getLocalHost().getHostAddress(); message.setFrom(email); message.setTo(user.getEmail()); message.setSubject(subject); Template template = null; template = velocityEngine.getTemplate(templateUrl); VelocityContext velocityContext = new VelocityContext(); velocityContext.put("user", user); velocityContext.put("hostname", hostname); StringWriter stringWriter = new StringWriter(); template.merge(velocityContext, stringWriter); message.setText(stringWriter.toString()); mailSender.send(message); }
public void doSend(SimpleMailMessage simpleMessage) throws MailException { mailSender.send(simpleMessage); }
private void sendMailMessage(SimpleMailMessage msg, OutboundMail out) { mailSender.send(msg); Long id = outboundMailDao.store(out); log.debug("Saved OutboundMail {} to {}", id, out.getToAddress()); }