Package com.typesafe.plugin

Examples of com.typesafe.plugin.MailerAPI


                    messageText);
        }

    private void sendEmail(final String mailFrom, String messageText,
        String messageHtml, String subject, String toEmail) {
      MailerAPI email = play.Play.application().plugin(MailerPlugin.class).email();
      email.setFrom(mailFrom);
      email.setSubject(subject);
      email.setRecipient(toEmail);
      Logger.debug("Mail.sendMail: Mail will be sent to {}", toEmail);
      email.send(messageText, messageHtml);
    }
View Full Code Here


        public EnvelopJob(Mail.Envelop envelop) {
            this.envelop = envelop;
        }

        public void run() {
            MailerAPI email = play.Play.application().plugin(MailerPlugin.class).email();

            final Configuration root = Configuration.root();
            final String mailFrom = root.getString("mail.from");
            email.setFrom(mailFrom);
            email.setSubject(envelop.subject);
            for (String toEmail : envelop.toEmails) {
                email.setRecipient(toEmail);
                Logger.debug("Mail.sendMail: Mail will be sent to " + toEmail);
            }

            final String mailSign = root.getString("mail.sign");
            email.send(envelop.message + "\n\n " + mailSign,
                    envelop.message + "<br><br>--<br>" + mailSign);

            Logger.debug("Mail sent - SMTP:" + root.getString("smtp.host")
                    + ":" + root.getString("smtp.port")
                    + " SSL:" + root.getString("smtp.ssl")
View Full Code Here

            mail = m;
        }

        @Override
        public void run() {
            final MailerAPI api = plugin.email();

            api.setSubject(mail.getSubject());
            api.setRecipient(mail.getRecipients());
            if (mail.getCc() != null) {
                api.setCc(mail.getCc());
            }
            if (mail.getBcc() != null) {
                api.setBcc(mail.getBcc());
            }
            api.setFrom(mail.getFrom());
            if (includeXMailerHeader) {
                api.addHeader("X-Mailer", MAILER + getVersion());
            }

            for (final Entry<String, List<String>> entry : mail
                    .getCustomHeaders().entrySet()) {
                final String headerName = entry.getKey();
                for (final String headerValue : entry.getValue()) {
                    api.addHeader(headerName, headerValue);
                }
            }
            if (mail.getReplyTo() != null) {
                api.setReplyTo(mail.getReplyTo());
            }
            for (final Mail.Attachment attachment : mail.getAttachments()) {
                if (attachment.getData() != null) {
                    api.addAttachment(attachment.getName(), attachment.getData(), attachment.getMimeType(), attachment.getDescription(), attachment.getDisposition());
                } else {
                    api.addAttachment(attachment.getName(), attachment.getFile(), attachment.getDescription(), attachment.getDisposition());
                }
            }
            if (mail.getBody().isBoth()) {
                // sends both text and html
                api.send(mail.getBody().getText(), mail.getBody().getHtml());
            } else if (mail.getBody().isText()) {
                // sends text/text
                api.send(mail.getBody().getText());
            } else {
                // if(mail.isHtml())
                // sends html
                api.sendHtml(mail.getBody().getHtml());
            }
        }
View Full Code Here

        public EnvelopJob(Envelop envelop) {
            this.envelop = envelop;
        }

        public void run() {
            MailerAPI email = play.Play.application().plugin(MailerPlugin.class).email();

            final Configuration root = Configuration.root();
            final String mailFrom = root.getString("mail.from");
            email.addFrom(mailFrom);
            email.setSubject(envelop.subject);
            for (String toEmail : envelop.toEmails) {
                email.addRecipient(toEmail);
                log.debug("Mail will be sent to {}", toEmail);
            }

            String message = envelop.message.body();
            log.debug("Mail Message: [{}]", message);
            email.sendHtml(message);

            log.debug("SMTP:" + root.getString("smtp.host")
                    + ":" + root.getString("smtp.port")
                    + " SSL:" + root.getString("smtp.ssl")
                    + " user:" + root.getString("smtp.user"));
View Full Code Here

TOP

Related Classes of com.typesafe.plugin.MailerAPI

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.