Package org.springframework.mail.javamail

Examples of org.springframework.mail.javamail.MimeMessageHelper.addAttachment()


      helper.setFrom("testfrom@springintegration.org");
      helper.setTo("testto@springintegration.org");
      helper.setSubject("Parsing of Attachments");
      helper.setText("Spring Integration Rocks!");

      helper.addAttachment(pictureName, byteArrayResource, "image/png");

    }
    catch (MessagingException e) {
      throw new MailParseException(e);
    }
View Full Code Here


                if (email.getReplyTo() != null) {
                    message.setReplyTo(email.getReplyTo());
                }
                for (Iterator iter = email.getAttachments().iterator(); iter.hasNext();) {
                    Attachment attachment = (Attachment) iter.next();
                    message.addAttachment(attachment.getName(), attachment.getResource());
                }
                for (Iterator iter = email.getInlineAttachments().iterator(); iter.hasNext();) {
                    Attachment attachment = (Attachment) iter.next();
                    message.addInline(attachment.getName(), attachment.getResource());
                }
View Full Code Here

                    message.setText(email.getHtmlBody(), true);
                }
                message.setReplyTo(email.getReplyTo());
                for (Iterator iter = email.getAttachments().iterator(); iter.hasNext();) {
                    Attachment attachment = (Attachment) iter.next();
                    message.addAttachment(attachment.getName(), attachment.getResource());
                }
                for (Iterator iter = email.getInlineAttachments().iterator(); iter.hasNext();) {
                    Attachment attachment = (Attachment) iter.next();
                    message.addInline(attachment.getName(), attachment.getResource());
                }
View Full Code Here

      helper.setSubject(subject);
      helper.setText(content, true);

      if (!MapUtils.isEmpty(attachment)) {
        for (Entry<String, File> entry : attachment.entrySet()) {
          helper.addAttachment(entry.getKey(), entry.getValue());
        }
      }

      mailSender.send(msg);
      logger.info("邮件发送成功");
View Full Code Here

        }

        helper.setText(bodyText);
        helper.setSubject(subject);

        helper.addAttachment(attachmentName, resource);

        ((JavaMailSenderImpl) mailSender).send(message);
    }
}
View Full Code Here

        true);

    // add the image
    FileSystemResource img = new FileSystemResource(new File(
        "./ch15/src/images/apress.gif"));
    helper.addAttachment("apress.gif", img);

    sender.send(msg);
  }

  public static void main(String[] args) throws Exception {
View Full Code Here

    // add attachments
    try {
      final List<Attachment> attachments = context.getAttachments();
      if(!attachments.isEmpty()) {
        for(final Attachment attachment : attachments) {
          helper.addAttachment(attachment.getName(), attachment.getDataSource());
        }
      }

    }
    catch(final MessagingException me) {
View Full Code Here

    // add attachments
    try {
      final List<Attachment> attachments = context.getAttachments();
      if(!attachments.isEmpty()) {
        for(final Attachment attachment : attachments) {
          helper.addAttachment(attachment.getName(), attachment.getDataSource());
        }
      }

    }
    catch(final MessagingException me) {
View Full Code Here

        }

        helper.setText(bodyText);
        helper.setSubject(subject);

        helper.addAttachment(attachmentName, resource);

        ((JavaMailSenderImpl) mailSender).send(message);
    }
}
View Full Code Here

                helper.setBcc(InternetAddress.parse(bcc));
            }

            for (Map.Entry<String, InputStreamSource> entry : mailDto
                    .getAttachments().entrySet()) {
                helper.addAttachment(entry.getKey(), entry.getValue());
            }

            javaMailSender.send(msg);
            logger.debug("send mail from {} to {}", from, to);
            mailDto.setSuccess(true);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.