Package com.m4f.business.domain

Examples of com.m4f.business.domain.ResultSearchEmail


   */
  @RequestMapping(value="/sendSearchResult", method=RequestMethod.POST)
  public @ResponseBody String sendSearchResultEmail(
      @RequestParam(required=true) Long resultSearchEmailId) {
    try {
      ResultSearchEmail email = inboxService.getResultSearchEmail(resultSearchEmailId, Locale.getDefault());
      Properties props = new Properties();
      Session session = Session.getDefaultInstance(props, null);   
      try {
        Message msg = new MimeMessage(session);
        msg.setFrom(new InternetAddress(new StringBuffer("info").append(EMAIL_DOMAIN_SUFFIX).toString(),
            this.getMessage("search.result.send.from")));
        msg.addRecipient(Message.RecipientType.TO,
                         new InternetAddress(email.getTo(), email.getToName()));
            msg.setSubject(this.getMessage("search.result.send.subject", email.getFromName()));
            msg.setText(this.getMessage("search.result.send.body", email.getResultLink()).toString());
            Transport.send(msg);
            email.setSent(Boolean.TRUE);
            inboxService.save(email, Locale.getDefault());
      } catch (AddressException e) {
        LOGGER.log(Level.SEVERE, StackTraceUtil.getStackTrace(e));
          } catch (MessagingException e) {
            LOGGER.log(Level.SEVERE, StackTraceUtil.getStackTrace(e));
          }
         
      LOGGER.info("SENDING SEARCH RESULT TO EMAIL -> " + email.getTo());
    } catch(Exception e) {
      LOGGER.log(Level.SEVERE, StackTraceUtil.getStackTrace(e));
      return "common.error";
    }
    return "task.launched";
View Full Code Here


  @RequestMapping(value = "/results/send", method = RequestMethod.GET)
  public String getResultSearchEmail(@RequestParam(required = true, defaultValue = "") String link,
      Model model) {
    try {
      ResultSearchEmail email = this.serviceLocator.getInboxService().createResultSearchEmail();
      email.setResultLink(link);
      model.addAttribute("email", email);
    } catch(Exception e) {
      LOGGER.log(Level.SEVERE, StackTraceUtil.getStackTrace(e));
      return "common.error";
    }
View Full Code Here

  @RequestMapping(value="/sendSearchResult", method=RequestMethod.POST)
  @ResponseStatus(HttpStatus.OK)
  public void sendSearchResultEmail(
      @RequestParam(required=true) Long resultSearchEmailId) {
    try {
      ResultSearchEmail email =
          this.serviceLocator.getInboxService().getResultSearchEmail(
              resultSearchEmailId, Locale.getDefault());
      Properties props = new Properties();
      Session session = Session.getDefaultInstance(props, null);   
      try {
        Message msg = new MimeMessage(session);
        msg.setFrom(new InternetAddress(new StringBuffer("info").append(EMAIL_DOMAIN_SUFFIX).toString(),
            this.getMessage("search.result.send.from")));
        msg.addRecipient(Message.RecipientType.TO,
                         new InternetAddress(email.getTo(), email.getToName()));
            msg.setSubject(this.getMessage("search.result.send.subject", email.getFromName()));
            msg.setText(this.getMessage("search.result.send.body", email.getResultLink()).toString());
            Transport.send(msg);
            email.setSent(Boolean.TRUE);
            this.serviceLocator.getInboxService().save(email, Locale.getDefault());
      } catch (AddressException e) {
        LOGGER.log(Level.SEVERE, StackTraceUtil.getStackTrace(e));
          } catch (MessagingException e) {
            LOGGER.log(Level.SEVERE, StackTraceUtil.getStackTrace(e));
          }
         
      LOGGER.info("SENDING SEARCH RESULT TO EMAIL -> " + email.getTo());
    } catch(Exception e) {
      LOGGER.severe(StackTraceUtil.getStackTrace(e));
    }
  }
View Full Code Here

TOP

Related Classes of com.m4f.business.domain.ResultSearchEmail

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.