Package mireka.smtp

Source Code of mireka.smtp.RejectExceptionExt

package mireka.smtp;

import org.subethamail.smtp.RejectException;

/**
* Indicates that the SMTP command just received from a client must be rejected.
* This exception corresponds to the SubEthaSMTP {@link RejectException}, but it
* uses SMTP enhanced mail system status codes and it is a checked exception.
*/
public class RejectExceptionExt extends Exception {
    private static final long serialVersionUID = 1530775593602824560L;

    private final EnhancedStatus reply;

    public RejectExceptionExt(EnhancedStatus reply) {
        this.reply = reply;
    }

    public EnhancedStatus getReply() {
        return reply;
    }

    /**
     * Converts this exception to a SubEthaSMTP {@link RejectException}.
     *
     * @return the {@link RejectException} corresponding to this exception.
     */
    public RejectException toRejectException() {
        return new RejectException(reply.getSmtpReplyCode(),
                reply.getMessagePrefixedWithEnhancedStatusCode());
    }
}
TOP

Related Classes of mireka.smtp.RejectExceptionExt

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.