Package org.springframework.mail.javamail

Examples of org.springframework.mail.javamail.MimeMessagePreparator


        this.endpoint = endpoint;
        this.sender = sender;
    }

    public void process(final Exchange exchange) {
        sender.send(new MimeMessagePreparator() {
            public void prepare(MimeMessage mimeMessage) throws Exception {
                endpoint.getBinding().populateMailMessage(endpoint, mimeMessage, exchange);
            }
        });
    }
View Full Code Here


        super(endpoint);
        this.sender = sender;
    }

    public void process(final Exchange exchange) {
        sender.send(new MimeMessagePreparator() {
            public void prepare(MimeMessage mimeMessage) throws Exception {
                getEndpoint().getBinding().populateMailMessage(getEndpoint(), mimeMessage, exchange);
                if (LOG.isDebugEnabled()) {
                    LOG.debug("Sending MimeMessage: " + MailUtils.dumpMessage(mimeMessage));
                }
View Full Code Here

    //creates a JobDataMap from the specified jobDetail of JobExecutionContext
    final JobDataMap dataMap = context.getJobDetail().getJobDataMap();
   
    JavaMailSender mailSender = MailingContext.getMailSender();
    //creates the mail message preparator from JobDataMap set in MailingServiceImpl
    MimeMessagePreparator preparator = new MimeMessagePreparator() {
          public void prepare(MimeMessage mimeMessage) throws Exception {
           VelocityEngine velocityEngine = MailingContext.getVelocityEngine();
             MimeMessageHelper message = new MimeMessageHelper(mimeMessage);
             MailMessage mailMessage = (MailMessage) dataMap.get("message");
             message.setFrom(mailMessage.getMsgFrom());
View Full Code Here

        }
    }

    public void send(MimeMessagePreparator[] preparators) throws MailException {
        for (int i = 0; i < preparators.length; i++) {
            MimeMessagePreparator preparator = preparators[i];
            send(preparator);
        }
    }
View Full Code Here

            throw new JBIException("You must configure the sender property");
        }
    }

    protected void process(final MessageExchange exchange, final NormalizedMessage message) throws Exception {
        MimeMessagePreparator preparator = new MimeMessagePreparator() {
            public void prepare(MimeMessage mimeMessage) throws MessagingException {
                marshaler.prepareMessage(mimeMessage, exchange, message);
            }
        };
        sender.send(preparator);
View Full Code Here

        }
    }

    public void send(MimeMessagePreparator[] preparators) throws MailException {
        for (int i = 0; i < preparators.length; i++) {
            MimeMessagePreparator preparator = preparators[i];
            send(preparator);
        }
    }
View Full Code Here

      final EmailSender email, final MessageTemplate tpl) {
    JavaMailSenderImpl sender = new JavaMailSenderImpl();
    sender.setHost(email.getHost());
    sender.setUsername(email.getUsername());
    sender.setPassword(email.getPassword());
    sender.send(new MimeMessagePreparator() {
      public void prepare(MimeMessage mimeMessage)
          throws MessagingException, UnsupportedEncodingException {
        MimeMessageHelper msg = new MimeMessageHelper(mimeMessage,
            false, email.getEncoding());
        msg.setSubject(tpl.getForgotPasswordSubject());
View Full Code Here

    public MessageCreator(JavaMailSender mailSender) {
        this.mailSender = mailSender;
    }

    public void sendMessage(final Map<String,Object> props) throws MailException {
        MimeMessagePreparator preparator = buildMimeMessagePreparator(props);
        this.mailSender.send(preparator);
    }
View Full Code Here

    }
   
    public abstract String buildMessageBody(EmailInfo info, Map<String,Object> props);
   
    public MimeMessagePreparator buildMimeMessagePreparator(final Map<String,Object> props) {
         MimeMessagePreparator preparator = new MimeMessagePreparator() {
             public void prepare(MimeMessage mimeMessage) throws Exception {
                 EmailTarget emailUser = (EmailTarget) props.get(EmailPropertyType.USER.getType());
                 EmailInfo info = (EmailInfo) props.get(EmailPropertyType.INFO.getType());
                 MimeMessageHelper message = new MimeMessageHelper(mimeMessage, (info.getAttachments() != null && info.getAttachments().size() > 0));
                 message.setTo(emailUser.getEmailAddress());
View Full Code Here

        return emailBody;
    }

    @Override
    public MimeMessagePreparator messagePreparator(final String emailTo, final String emailFrom, final String subject, final String emailText) {
        return new MimeMessagePreparator() {
            public void prepare(MimeMessage mimeMessage) throws Exception {
                MimeMessageHelper message = new MimeMessageHelper(mimeMessage);
                message.setFrom(emailFrom);
                message.setTo(emailTo);
                message.setSubject(subject);
View Full Code Here

TOP

Related Classes of org.springframework.mail.javamail.MimeMessagePreparator

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.