Package org.springframework.mail.javamail

Examples of org.springframework.mail.javamail.MimeMessageHelper


     * @param message
     */
    public void sendNotificationStatusAccount(final SignUpBean user, final String message) {
        MimeMessagePreparator preparator = new MimeMessagePreparator() {
           public void prepare(MimeMessage mimeMessage) throws Exception {
              MimeMessageHelper message = new MimeMessageHelper(mimeMessage);
              message.setTo(user.getEmail());
              message.setSubject(buildSubject("Notificaction status account"));
              message.setFrom(noEmailResponse);
              Map model = new HashMap();
              getLogo(model);
              model.put("user", user);
              final String[] properties = {EnMePlaceHolderConfigurer.getProperty("mail.message.app.name")};
              model.put("presentationMessage", getMessageProperties("mail.message.default.user.presentation", buildCurrentLocale(), null));
              model.put("userActivateMessage", getMessageProperties("mail.message.user.activate", buildCurrentLocale(), properties));

              getGreetingMessage(model);
              String text = VelocityEngineUtils.mergeTemplateIntoString(
                 velocityEngine, "/org/encuestame/business/mail/templates/notification-account.vm", model);
              message.setText(text, true);
           }
        };
        send(preparator);
     }
View Full Code Here


            final String subject,
            final String from,
            final String template) {
        final MimeMessagePreparator preparator = new MimeMessagePreparator() {
           public void prepare(MimeMessage mimeMessage) throws Exception {
              final MimeMessageHelper message = new MimeMessageHelper(mimeMessage);
              message.setTo(email);
              message.setSubject(buildSubject(subject));
              message.setFrom(from);
              final String text = VelocityEngineUtils.mergeTemplateIntoString(
                 velocityEngine, template, model);
              message.setText(text, true);
           }
        };
        this.send(preparator);
     }
View Full Code Here

        final String content = message.getPayload().toString();

        MimeMessagePreparator preparator = new MimeMessagePreparator() {
            public void prepare(MimeMessage mimeMessage)
                    throws MessagingException {
                MimeMessageHelper message = new MimeMessageHelper(mimeMessage);
                message.setSubject("Some new subject");
                message.setTo(messageHeaders.get(MailHeaders.TO).toString().split(";"));
                message.setFrom(messageHeaders.get(MailHeaders.FROM).toString());
                message.setText(content, true);
            }
        };
        mailSender.send(preparator);
    }
View Full Code Here

        throws Exception;

    public void run() throws Exception {
      MimeMessage mimeMessage = createMock(MimeMessage.class);

      MimeMessageHelper message = PowerMock
          .createMockAndExpectNew(MimeMessageHelper.class, mimeMessage, true, "UTF-8");
      expectations(message);

      JavaMailSender sender = createMock(JavaMailSender.class);
      expect(sender.createMimeMessage()).andReturn(mimeMessage);
View Full Code Here

        throws Exception;

    public void run() throws Exception {
      MimeMessage mimeMessage = createMock(MimeMessage.class);

      MimeMessageHelper message = PowerMock.createMockAndExpectNew(
          MimeMessageHelper.class, mimeMessage, true, "UTF-8");
      expectations(message);

      JavaMailSender sender = createMock(JavaMailSender.class);
      expect(sender.createMimeMessage()).andReturn(mimeMessage);
View Full Code Here

        throws Exception;

    public void run() throws Exception {
      MimeMessage mimeMessage = createMock(MimeMessage.class);

      MimeMessageHelper message = PowerMock.createMockAndExpectNew(
          MimeMessageHelper.class, mimeMessage, true, "UTF-8");
      expectations(message);

      JavaMailSender sender = createMock(JavaMailSender.class);
      expect(sender.createMimeMessage()).andReturn(mimeMessage);
View Full Code Here

   */
  public static MailBuilder newMail(final JavaMailSender sender,
      final String encoding) throws MessagingException {
    Validate.notNull(sender, "The email sender is required.");
    Validate.notNull(encoding, "The encoding for the email text.");
    return new MailBuilder(new MimeMessageHelper(sender.createMimeMessage(),
        true, encoding));
  }
View Full Code Here

   * @throws MessagingException If the message cannot be created.
   */
  public static MailBuilder newMail(final JavaMailSender sender)
      throws MessagingException {
    Validate.notNull(sender, "The email sender is required.");
    return new MailBuilder(new MimeMessageHelper(sender.createMimeMessage(),
        true, "UTF-8"));
  }
View Full Code Here

   * @throws MessagingException If the message cannot be created.
   */
  public static MailBuilder newSimpleMail(final JavaMailSender sender)
      throws MessagingException {
    Validate.notNull(sender, "The email sender is required.");
    return new MailBuilder(new MimeMessageHelper(sender.createMimeMessage()));
  }
View Full Code Here

        }
        Session mailSession = this.createSmtpSession(emailSetting);
        if (mailSession != null) {
            Transport transport = mailSession.getTransport();
            MimeMessage msg = new MimeMessage(mailSession);
            MimeMessageHelper helper = new MimeMessageHelper(msg, true, "utf-8");
            helper.setFrom(emailSetting.getFrom_address());
            helper.setTo(toAddress);
            helper.setSubject("Test Mail From " + emailSetting.getFrom_name());
            helper.setText(
                    "This is test mail from " + emailSetting.getFrom_name(),
                    true);
            transport.connect();
            transport.sendMessage(msg,
                    msg.getRecipients(Message.RecipientType.TO));
View Full Code Here

TOP

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

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.