Package org.springframework.mail.javamail

Examples of org.springframework.mail.javamail.MimeMessagePreparator


    private UserDetailsService userDetailsService;

    @VisibleForTesting
    protected MimeMessagePreparator prepareSuccessMessage(final String userId, final String template, final String status,
            final String server) {
        return new MimeMessagePreparator() {
            public void prepare(MimeMessage mimeMessage) throws Exception {
                CbUser user = userDetailsService.getDetails(userId, UserFilterField.USERID);
                MimeMessageHelper message = new MimeMessageHelper(mimeMessage);
                message.setFrom(msgFrom);
                message.setTo(user.getUsername());
View Full Code Here


        };
    }

    @VisibleForTesting
    protected MimeMessagePreparator prepareFailMessage(final String userId, final String template, final String status) {
        return new MimeMessagePreparator() {
            public void prepare(MimeMessage mimeMessage) throws Exception {
                CbUser user = userDetailsService.getDetails(userId, UserFilterField.USERID);
                MimeMessageHelper message = new MimeMessageHelper(mimeMessage);
                message.setFrom(msgFrom);
                message.setTo(user.getUsername());
View Full Code Here

            }
        };
    }

    public void sendSuccessEmail(String email, String ambariServer) {
        MimeMessagePreparator mimeMessagePreparator = prepareSuccessMessage(email, "templates/cluster-installer-mail-success.ftl", "SUCCESS", ambariServer);
        sendInstallationEmail(mimeMessagePreparator);
    }
View Full Code Here

        MimeMessagePreparator mimeMessagePreparator = prepareSuccessMessage(email, "templates/cluster-installer-mail-success.ftl", "SUCCESS", ambariServer);
        sendInstallationEmail(mimeMessagePreparator);
    }

    public void sendFailEmail(String email) {
        MimeMessagePreparator mimeMessagePreparator = prepareFailMessage(email, "templates/cluster-installer-mail-fail.ftl", "FAILED");
        sendInstallationEmail(mimeMessagePreparator);
    }
View Full Code Here

    context.registerShutdownHook();
    context.refresh();

    final JavaMailSender ms = context.getBean(JavaMailSender.class);
    final String toEmailAddressToUse = toEmailAddress;
    final MimeMessagePreparator preparator = new MimeMessagePreparator() {

      public void prepare(MimeMessage mimeMessage) throws Exception {

        mimeMessage.setRecipient(Message.RecipientType.TO,
            new InternetAddress(toEmailAddressToUse));
View Full Code Here

            this.mailSender = mailSender;
        }

        public void run() {
            try {
                mailSender.send(new MimeMessagePreparator() {
                    public void prepare(MimeMessage mimeMessage) throws MessagingException {
                        MimeMessageHelper message = new MimeMessageHelper(mimeMessage, false, "UTF-8");
                        message.setFrom(from);
                        message.setTo(to);
                        message.setSubject(subject);
View Full Code Here

  private void sendMimeMessage( final List<String> recipients, final String from, final String subject, final String body, final File[] attachments ) {
    for (String recipient : recipients) {
      final String to = recipient;
      Assert.isTrue( to != null && to.length() != 0 && to.indexOf( '@' ) > -1 );
      logger.debug("Sending email to: {} from: {} subject: {}", new Object[]{to, from, subject});
      javaMailSender.send(new MimeMessagePreparator() {
        @Override
        public void prepare( MimeMessage mimeMessage ) throws MessagingException {
          MimeMessageHelper message;
          message = new MimeMessageHelper(mimeMessage, MimeMessageHelper.MULTIPART_MODE_MIXED, MAIL_ENCODING);
          message.setFrom( from );
View Full Code Here

    /**
     * Send Email Invitation.
     * @param invitation {@link InvitationBean}
     */
    public void sendEmailJoinInvitation(final String email, final String username) {
        final MimeMessagePreparator preparator = new MimeMessagePreparator() {
        public void prepare(MimeMessage mimeMessage) throws Exception {
              MimeMessageHelper message = new MimeMessageHelper(mimeMessage);
              message.setTo(email);
              message.setSubject(buildSubject(getMessageProperties("mail.message.join.us.subject")));
              message.setFrom(noEmailResponse);
View Full Code Here

    /**
     * Send Email Invitation.
     * @param invitation {@link InvitationBean}
     */
    public void sendEmailInvitation(final InvitationBean invitation) {
        final MimeMessagePreparator preparator = new MimeMessagePreparator() {
        public void prepare(MimeMessage mimeMessage) throws Exception {
              MimeMessageHelper message = new MimeMessageHelper(mimeMessage);
              message.setTo(invitation.getEmail());
              message.setSubject(buildSubject(getMessageProperties("email.messages.new.confirmation")));
              message.setFrom(noEmailResponse);
View Full Code Here

     * @param notification {@link NotificationBean}
     * Will by replaced by queued email
     */
    @Deprecated
    public void sendEmailNotification(final NotificationBean notification) {
        MimeMessagePreparator preparator = new MimeMessagePreparator() {
           public void prepare(MimeMessage mimeMessage) throws Exception {
              MimeMessageHelper message = new MimeMessageHelper(mimeMessage);
              message.setTo(notification.getEmail());
              message.setSubject(buildSubject("New Password Confirmation"));
              message.setFrom(noEmailResponse);
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.