001package org.codemonkey.simplejavamail;
002
003import javax.mail.MessagingException;
004
005/**
006 * This exception is used to communicate errors during the sending of email.
007 * 
008 * @author Benny Bottema
009 */
010@SuppressWarnings("serial")
011public final class MailException extends RuntimeException {
012
013        protected static final String GENERIC_ERROR = "Generic error: %s";
014        protected static final String MISSING_HOST = "Can't send an email without host";
015        protected static final String MISSING_USERNAME = "Can't have a password without username";
016        protected static final String INVALID_ENCODING = "Encoding not accepted: %s";
017        protected static final String INVALID_RECIPIENT = "Invalid TO address: %s";
018        protected static final String INVALID_REPLYTO = "Invalid REPLY TO address: %s";
019        protected static final String INVALID_SENDER = "Invalid FROM address: %s";
020        protected static final String MISSING_SENDER = "Email is not valid: missing sender";
021        protected static final String MISSING_RECIPIENT = "Email is not valid: missing recipients";
022        protected static final String MISSING_SUBJECT = "Email is not valid: missing subject";
023        protected static final String MISSING_CONTENT = "Email is not valid: missing content body";
024
025        protected MailException(final String message) {
026                super(message);
027        }
028
029        protected MailException(final String message, final MessagingException cause) {
030                super(message, cause);
031        }
032}