Package org.springframework.mail.javamail

Examples of org.springframework.mail.javamail.MimeMessagePreparator


    public void sendInvite(final MailingListEntry invitation)
            throws InfrastructureException {
        // send mail
        try {
            MimeMessagePreparator preparator = new MimeMessagePreparator() {
                public void prepare(MimeMessage mimeMessage)
                        throws Exception {
                    MimeMessageHelper message = new MimeMessageHelper(
                            mimeMessage);
                    message.setTo(invitation.getEmail());
View Full Code Here


        messageHelper.addInline(resourceIdentifier, resource);
    }

    private EmailServiceTokenModel sendVerificationEmail(final EmailServiceTokenModel emailVerificationModel, final String emailSubject,
                                                         final String velocityModel, final Map<String, String> resources) {
        MimeMessagePreparator preparator = new MimeMessagePreparator() {
            public void prepare(MimeMessage mimeMessage) throws Exception {
                MimeMessageHelper messageHelper = new MimeMessageHelper(mimeMessage, MimeMessageHelper.MULTIPART_MODE_RELATED, "UTF-8");
                messageHelper.setTo(emailVerificationModel.getEmailAddress());
                messageHelper.setFrom(config.getEmailFromAddress());
                messageHelper.setReplyTo(config.getEmailReplyToAddress());
View Full Code Here

        email.setBcc("bcc@bla.com");
        email.setPriority(EmailPriority.HIGH);
        email.setSubject("subject");
        email.setTextBody("text");

        MimeMessagePreparator preparator = sender.generateMimeMessagePreparator(email, "UTF-8");
        MimeMessage mimeMessage = createMimeMessage();
        preparator.prepare(mimeMessage);

        assertEquals(1, mimeMessage.getFrom().length);
        InternetAddress address = (InternetAddress)mimeMessage.getFrom()[0];
        assertEquals("From", address.getPersonal());
        assertEquals("from@bla.com", address.getAddress());
View Full Code Here

     * @param email The email to be translated.
     * @param encoding The encoding of the email.
     * @return The appropriate MimeMessagePreparator.
     */
    protected MimeMessagePreparator generateMimeMessagePreparator(final Email email, final String encoding) {
        return new MimeMessagePreparator() {
            public void prepare(MimeMessage mimeMessage) throws Exception {
                mimeMessage.setHeader(HEADER_PRIORITY, String.valueOf(email.getPriority().getRank()));
                for (Iterator iter = email.getHeaders().entrySet().iterator(); iter.hasNext();) {
                    Map.Entry entry = (Map.Entry)iter.next();
                    mimeMessage.setHeader(String.valueOf(entry.getKey()), String.valueOf(entry.getValue()));
View Full Code Here

     *
     * @param email The email to be translated.
     * @return The appropriate MimeMessagePreparator.
     */
    protected MimeMessagePreparator generateMimeMessagePreparator(final Email email) {
        return new MimeMessagePreparator() {
            public void prepare(MimeMessage mimeMessage) throws Exception {
                mimeMessage.setHeader(HEADER_PRIORITY, String.valueOf(email.getPriority().getRank()));
                MimeMessageHelper message =
                    new MimeMessageHelper(mimeMessage, MimeMessageHelper.MULTIPART_MODE_RELATED, getEncoding());
                message.setTo(email.getTo());
View Full Code Here

        email.setBcc("bcc@bla.com");
        email.setPriority(EmailPriority.HIGH);
        email.setSubject("subject");
        email.setTextBody("text");
       
        MimeMessagePreparator preparator = dispatcher.generateMimeMessagePreparator(email);
        MimeMessage mimeMessage = createMimeMessage();
        preparator.prepare(mimeMessage);

        assertEquals(1, mimeMessage.getFrom().length);
        InternetAddress address = (InternetAddress)mimeMessage.getFrom()[0];
        assertEquals("From", address.getPersonal());
        assertEquals("from@bla.com", address.getAddress());
View Full Code Here

        super();       
    }   
   
   
    public void mail(final String email, final Map map, final String bodyTemplatePrefix, final String subjectTemplatePrefix) {
        MimeMessagePreparator preparator = new MimeMessagePreparator() {
            public void prepare(MimeMessage mimeMessage) throws MessagingException, IOException {
                mimeMessage.setRecipient(Message.RecipientType.TO, new InternetAddress(email));               

                //
                // Get the subject
View Full Code Here

        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);
                if (LOG.isDebugEnabled()) {
                    LOG.debug("Sending MimeMessage: " + MailUtils.dumpMessage(mimeMessage));
                }
View Full Code Here

  public boolean send(final String to, final String from, final String subject, final String text)
      throws ServiceException {
   
    logger.info("Preparando envio de e-mail...");
   
    MimeMessagePreparator preparator = new MimeMessagePreparator() {
      public void prepare(MimeMessage mimeMessage) throws Exception {
        MimeMessageHelper MMhelper = new MimeMessageHelper(mimeMessage, true, "UTF-8");
        MMhelper.setTo(to);
        MMhelper.setFrom(from);
        MMhelper.setSubject(subject);
View Full Code Here

        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

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.