001    package railo.runtime.net.mail;
002    
003    import railo.commons.collections.HashTable;
004    
005    public final class SMTPExceptionImpl extends SMTPException {
006        
007        private static HashTable codes=new HashTable();
008        
009        static {
010            codes.put("211","System status, or system help reply");
011            codes.put("214"," Help message (Information on how to use the receiver or the meaning of a particular non-standard command; this reply is useful only to the human user)");
012            codes.put("220","Service ready");
013            codes.put("221","Service closing transmission channel");
014            codes.put("250","Requested mail action okay, completed");
015            codes.put("251","User not local; will forward to");
016            codes.put("354","Start mail input; end with .");
017            codes.put("421","Service not available, closing transmission channel (This may be a reply to any command if the service knows it must shut down) ");
018            codes.put("450","Requested mail action not taken: mailbox unavailable (E.g., mailbox busy)");
019            codes.put("451","Requested action aborted: local error in processing");
020            codes.put("452","Requested action not taken: insufficient system storage");
021            codes.put("500","Syntax error, command unrecognized (This may include errors such as command line too long)");
022            codes.put("501","Syntax error in parameters or arguments");
023            codes.put("502","Command not implemented");
024            codes.put("503","Bad sequence of commands");
025            codes.put("504","Command parameter not implemented");
026            codes.put("550","Requested action not taken: mailbox unavailable (E.g., mailbox not found, no access)");
027            codes.put("551","User not local; please try");
028            codes.put("552","Requested mail action aborted: exceeded storage allocation");
029            codes.put("553","Requested action not taken: mailbox name not allowed (E.g., mailbox syntax incorrect) ");
030            codes.put("554","Transaction failed (Or, in the case of a connection-opening response, \"No SMTP service here\")");
031            codes.put("252","Cannot VRFY user, but will accept message and attempt delivery");
032        }
033        
034        public SMTPExceptionImpl(String message) {
035            super(message);
036        }
037        public SMTPExceptionImpl(int code) {
038            this(doMessage(code));
039        }
040        private static String doMessage(int code) {
041            String message=(String) codes.get(String.valueOf(code));
042            if(message==null) message="SMTP Code "+code;
043            else message=code+" - "+message;
044            return message;
045        }
046    }