Package org.jayasoft.woj.common.services.mail

Examples of org.jayasoft.woj.common.services.mail.BasicMail


        // async notification of the error
        Thread thread = new Thread("notif-error") {
          public void run() {
                try {
                    LOGGER.debug("sending error e-mail: "+msg);
                    BasicMail m = new BasicMail();
                    m.setFrom("admin@worldofjava.org");
                    m.setTo(new String[] {"admin@worldofjava.org"});
                    m.setSubject("an error occured on "+getFullWhoami());
                    m.setContent(buildMessage(msg, t, getWhoami()));
                    MailService.getMailService(getSmtpHost(), getSmtpPort()).sendMail(m);
                    LOGGER.info("error e-mail sent: "+msg);
                } catch (Exception e) {
                    LOGGER.error("failed to send error mail: "+msg, e);
                }
View Full Code Here


          from = getMailFromId(fromId);
        }
        String[] mails = getMailFromIds(toIds);
        if (mails.length != 0) {
          try {
            BasicMail m = new BasicMail();
            m.setFrom(from);
            m.setSubject(subject);
            m.setContent(msg);
            if (confidential) {
              // Confidential sending.
              for (int i = 0; i < mails.length; i++) {
                m.setTo(new String[] {mails[i]});
                MailService.getMailService(getSmtpHost(), getSmtpPort()).sendMail(m);
              }
            } else {
              // Non confindential sending.
              m.setTo(mails);
              MailService.getMailService(getSmtpHost(), getSmtpPort()).sendMail(m);             
            }
          } catch (MessagingException e) {
                  LOGGER.error("failed to send the mail.", e);
            // TODO Handle this exception
View Full Code Here

        m.setContent((String)_rbTE.build(MAIL_REGISTRATION_SUCCESSFUL, params));
        return m;
    }

    public Mail createNewUserMailAdmin(User user) {
    BasicMail m = new BasicMail();

    m.setFrom(FROM_MAIL);
    m.setTo(new String[] { FROM_MAIL });
    m.setSubject("World Of Java : New user :" + user.getEmail());

    Map params = new LinkedHashMap();
    params.put("login", user.getLogin());
    params.put("mail", user.getEmail());
    String license = "";
    if (user instanceof UserImpl) {
      UserImpl userImpl = (UserImpl) user;
      Set ls = userImpl.getBuyedLicenses();
      if(ls != null) {
        for (Iterator iter = ls.iterator(); iter.hasNext();) {
          License l = (License) iter.next();
          license += l.toString()+",";
        }
      }
    }
    params.put("license", license);
    m.setContent((String) _rbTE.build(MAIL_NEW_USER_ADMIN, params));
    return m;
  }
View Full Code Here

    m.setContent((String) _rbTE.build(MAIL_NEW_USER_ADMIN, params));
    return m;
  }

  public Mail createEmailVerificationMail(User user) {
        BasicMail m = new BasicMail();
       
        m.setFrom(FROM_MAIL);
        m.setTo(new String[] {user.getEmail()});
        m.setSubject(getMailTitle(MAIL_VERIFICATION));
       
        Map params = new LinkedHashMap();
        params.put("login", user.getLogin());
        params.put("id", ""+user.getId());
        m.setContent(getMailContent(MAIL_VERIFICATION, params));
        return m;
    }
View Full Code Here

        m.setContent(getMailContent(MAIL_VERIFICATION, params));
        return m;
    }
   
  public Mail createNewBuyConfirmationMail(User user, Order order, List licenses, Invoice invoice) {
        BasicMail m = new BasicMail();
       
        m.setFrom(FROM_MAIL);
        m.setTo(new String[] {user.getEmail()});
        m.setBcc(new String[] {PAYEMENT_MAIL});
        m.setSubject(getMailTitle(PAYMENT_CONFIRMATION));
       
        Map params = new LinkedHashMap();
        params.put("login", user.getLogin());
        if (Purchaser.USER.equals(order.getPurchaser().getType())) {
            params.put("clause", _rbTE.build(PAYMENT_CONFIRMATION_USER_CLAUSE, params));
        } else {
            params.put("clause", "");
        }
        m.setContent(getMailContent(PAYMENT_CONFIRMATION, params));
        m.addAttachment(invoice.getPdf(), "woj-invoice-" + TimeUtil.getGMTMillis(), ".pdf");
        return m;
    }
View Full Code Here

        m.addAttachment(invoice.getPdf(), "woj-invoice-" + TimeUtil.getGMTMillis(), ".pdf");
        return m;
    }

  public Mail createNewBuyConfirmationMailAdmin(User user, Order order, List licenses) {
        BasicMail m = new BasicMail();
       
        m.setFrom(FROM_MAIL);
        m.setTo(new String[] {FROM_MAIL});
        int nbLicenses = (licenses!=null?licenses.size():0);
    m.setSubject("World Of Java : "+nbLicenses+" licence sold! ("+order.getTotalCost()+") - "+user.getLogin());
       
        Map params = new LinkedHashMap();
        params.put("login", user.getLogin());
        params.put("nblic", new Integer(nbLicenses));
        params.put("totalprice", new Double(order.getTotalCost()));
        params.put("product", order.getPrice().getProduct().getName());
        m.setContent((String)_rbTE.build(PAYMENT_ADMIN_NOTIF, params));
        return m;
    }
View Full Code Here

        m.setContent((String)_rbTE.build(PAYMENT_ADMIN_NOTIF, params));
        return m;
    }
   
    public Mail createConfirmationMail(User user) {
        BasicMail m = new BasicMail();
       
        m.setFrom(FROM_MAIL);
        m.setTo(new String[] {user.getEmail()});
        m.setSubject(getMailTitle(MAIL_CHANGED_CONFIRMATION));
       
        Map params = new LinkedHashMap();
        params.put("login", user.getLogin());
        params.put("id", "" + user.getId());
        m.setContent(getMailContent(MAIL_CHANGED_CONFIRMATION, params));
        return m;
    }
View Full Code Here

        m.setContent(getMailContent(MAIL_CHANGED_CONFIRMATION, params));
        return m;
    }
   
    public Mail createFidelityProgramPointEarnedMail(User user, int earnedpoint, int totalpoint , String reason) {
        BasicMail m = new BasicMail();
       
        m.setFrom(FROM_MAIL);
        m.setTo(new String[] {user.getEmail()});
        m.setSubject(getMailTitle(MAIL_FIDELITY_POINTS_EARNED));
       
        Map params = new LinkedHashMap();
        params.put("firstName", ((UserImpl) user).getFirstName());
        params.put("lastName", ((UserImpl) user).getLastName());
        params.put("reason",  reason);
        params.put("earnedpoint", "" + earnedpoint);
        params.put("totalpoint", "" + totalpoint);
        m.setContent(getMailContent(MAIL_FIDELITY_POINTS_EARNED, params));
        return m;
    }
View Full Code Here

        m.setContent(getMailContent(MAIL_FIDELITY_POINTS_EARNED, params));
        return m;
    }
   
    public Mail createFidelityProgramGiftOrdered(UserImpl user, String gift, int points, int newUserPoint) {
        BasicMail m = new BasicMail();
       
        m.setFrom(FROM_MAIL);
        m.setTo(new String[] {user.getEmail()});
        m.setBcc(new String[] {MailFactory.FROM_MAIL});
        m.setSubject(getMailTitle(MAIL_FIDELITY_GIFT_ORDER_CONFIRMATION));
       
        Map params = new LinkedHashMap();
        params.put("firstName", ((UserImpl) user).getFirstName());
        params.put("lastName", ((UserImpl) user).getLastName());
        params.put("gift",  gift);
        params.put("points", "" + points);
        params.put("newUserPoint", "" + newUserPoint);
        m.setContent(getMailContent(MAIL_FIDELITY_GIFT_ORDER_CONFIRMATION, params));
        return m;
    }
View Full Code Here

        m.setContent(getMailContent(MAIL_FIDELITY_GIFT_ORDER_CONFIRMATION, params));
        return m;
    }
   
    public Mail createSpreadWOJMail(User user, String destEmail, String message) {
        BasicMail m = new BasicMail();
       
        m.setFrom(user.getEmail());
        m.setTo(new String[] {destEmail});
        m.setSubject(getMailTitle(MAIL_SPREAD_WOJ));
       
        Map params = new LinkedHashMap();
        params.put("godfather", user.getLogin());
        params.put("msg", message);
        m.setContent(getMailContent(MAIL_SPREAD_WOJ, params));
        return m;
    }
View Full Code Here

TOP

Related Classes of org.jayasoft.woj.common.services.mail.BasicMail

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.