Package com.music.service.EmailService

Examples of com.music.service.EmailService.EmailDetails


        Map<String, Object> model = new HashMap<>();
        String paddedString = StringUtils.leftPad(String.valueOf(purchase.getId()), 10, '0');
        model.put("zipUrl", baseUrl + "/purchase/download/" + purchase.getId() + "/"
                        + SecurityUtils.hmac(paddedString, hmacKey));

        EmailDetails emailDetails = new EmailDetails().addTo(purchase.getEmail())
                .setFrom(emailSender)
                .setHtml(true)
                .setSubject("Your Computoser purchase")
                .setMessageTemplate("purchase.vm")
                .setMessageTemplateModel(model);
View Full Code Here


        final List<Piece> includedPieces = new ArrayList<>(pieces.subList(0, Math.min(pieces.size(), 3)));
        if (includedPieces.isEmpty()) {
            return;
        }
        // for now - using the same data for all users. TODO send personalized selection
        final EmailDetails baseDetails = new EmailDetails();
        baseDetails.setMessageTemplate("digest.vm");
        baseDetails.setSubject("Computoser-generated tracks digest for you");
        Map<String, Object> model = Maps.newHashMap();
        baseDetails.setMessageTemplateModel(model);
        baseDetails.setFrom(from);
        baseDetails.setHtml(true);
        userDao.performBatched(User.class, 100, new PageableOperation<User>() {
            @Override
            public void execute() {
                for (User user : getData()) {
                    if (user.isReceiveDailyDigest() && StringUtils.isNotBlank(user.getEmail())) {
                        EmailDetails email = SerializationUtils.clone(baseDetails);
                        email.setTo(user.getEmail());
                        email.setCurrentUser(user);
                        String hmac = SecurityUtils.hmac(user.getEmail(), hmacKey);
                        email.getMessageTemplateModel().put("pieces", includedPieces);
                        email.getMessageTemplateModel().put("hmac", hmac);
                        // needed due to SES restrictions
                        try {
                            Thread.sleep(500);
                        } catch (InterruptedException e) {
                            throw new IllegalStateException(e);
View Full Code Here

            logger.error("Problem processing twitter music request", ex);
        }
    }

    private void sendEmail(TimelineMusic music) {
        EmailDetails details = new EmailDetails();
        String url = baseUrl + "/twitterMusic/" + music.getId();
        details.setMessage("Hello.<br />Your twitter music is ready - check it out at <a href=\"" + url + "\">" + url + "</a>");
        details.setSubject("Your twitter music is ready");
        details.setFrom(from);
        details.setTo(music.getUser().getEmail());
        details.setHtml(true);
        emailService.send(details);
    }
View Full Code Here

TOP

Related Classes of com.music.service.EmailService.EmailDetails

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.