Example usage for org.springframework.mail MailParseException MailParseException

List of usage examples for org.springframework.mail MailParseException MailParseException

Introduction

In this page you can find the example usage for org.springframework.mail MailParseException MailParseException.

Prototype

public MailParseException(String msg, Throwable cause) 

Source Link

Document

Constructor for MailParseException.

Usage

From source file:org.grouter.common.mail.MailHandler.java

public void sendEmail(MailDto mailDto) {
    Properties props = new Properties();
    Session session = Session.getDefaultInstance(props, null);
    MimeMessage mimeMessageContent = new MimeMessage(session);

    try {//  w w  w .  ja  v a2  s . c o  m
        //           createHeader(mimeMessageContent, mailDto.getTo(), mailDto.getSubject(),
        //                   mailDto.getFrom(), mailDto.getSenderNote());

        createHtmlAndPlainTextBody(mimeMessageContent, mailDto);

    } catch (Exception e) {
        logger.error(e, e);
        throw new MailParseException("Failed to create message", e);
    }

    // send

}

From source file:org.springframework.mail.javamail.JavaMailSenderImpl.java

public MimeMessage createMimeMessage(InputStream contentStream) throws MailException {
    try {/*from w w  w  .  j  ava2 s  . com*/
        return new MimeMessage(getSession(), contentStream);
    } catch (MessagingException ex) {
        throw new MailParseException("Could not parse raw MIME content", ex);
    }
}