Example usage for javax.mail MessagingException MessagingException

List of usage examples for javax.mail MessagingException MessagingException

Introduction

In this page you can find the example usage for javax.mail MessagingException MessagingException.

Prototype

public MessagingException(String s, Exception e) 

Source Link

Document

Constructs a MessagingException with the specified Exception and detail message.

Usage

From source file:org.xwiki.mail.internal.DefaultMailSender.java

@Override
public void send(MimeMessage message, Session session) throws MessagingException {
    DefaultMailResultListener listener = new DefaultMailResultListener();
    sendAsynchronously(message, session, listener);
    waitTillSent(Long.MAX_VALUE);
    BlockingQueue<Exception> errorQueue = listener.getExceptionQueue();
    if (!errorQueue.isEmpty()) {
        throw new MessagingException(String.format("Failed to send mail message [%s]", message),
                errorQueue.peek());/*from  w  w  w  .ja v a 2s .  co m*/
    }
}