Examples of SMTPResponse


Examples of org.apache.james.protocols.smtp.SMTPResponse

     * @see org.apache.james.smtpserver.protocol.ConnectHandler#onConnect(SMTPSession)
     */
    public Response onConnect(SMTPSession session) {
        String smtpGreeting = session.getSMTPGreeting();

        SMTPResponse welcomeResponse;
        // if no greeting was configured use a default
        if (smtpGreeting == null) {
            // Initially greet the connector
            // Format is:  Sat, 24 Jan 1998 13:16:09 -0500
            welcomeResponse = new SMTPResponse(SMTPRetCode.SERVICE_READY,
                          new StringBuilder(256)
                          .append(session.getHelloName())
                          .append(" SMTP Server (")
                          .append(getProductName())
                          .append(") ready ")
                          .append(rfc822DateFormat.format(new Date())));
        } else {
            welcomeResponse = new SMTPResponse(SMTPRetCode.SERVICE_READY,smtpGreeting);
        }
        return welcomeResponse;
    }
View Full Code Here

Examples of org.apache.james.protocols.smtp.SMTPResponse

     * @return
     */
    private SMTPResponse doRSET(SMTPSession session, String argument) {
        if ((argument == null) || (argument.length() == 0)) {
            session.resetState();
            return new SMTPResponse(SMTPRetCode.MAIL_OK, DSNStatus.getStatus(DSNStatus.SUCCESS,DSNStatus.UNDEFINED_STATUS)+" OK");
        } else {
            return new SMTPResponse(SMTPRetCode.SYNTAX_ERROR_COMMAND_UNRECOGNIZED, DSNStatus.getStatus(DSNStatus.PERMANENT,DSNStatus.DELIVERY_INVALID_ARG)+" Unexpected argument provided with RSET command");
        }
    }
View Full Code Here

Examples of org.apache.james.protocols.smtp.SMTPResponse

    /**
     * handles HELP command
     *
    **/
    public Response onCommand(SMTPSession session, Request request){
        return new SMTPResponse(SMTPRetCode.UNIMPLEMENTED_COMMAND, DSNStatus.getStatus(DSNStatus.PERMANENT,DSNStatus.SYSTEM_NOT_CAPABLE)+" " + COMMAND_NAME + " is not supported");
    }
View Full Code Here

Examples of org.apache.james.protocols.smtp.SMTPResponse

     * This method informs the client that the command is
     * not implemented.
     *
     */
    public Response onCommand(SMTPSession session, Request request) {
        return new SMTPResponse(SMTPRetCode.UNIMPLEMENTED_COMMAND, DSNStatus.getStatus(DSNStatus.PERMANENT,DSNStatus.SYSTEM_NOT_CAPABLE)+" EXPN is not supported");
    }
View Full Code Here

Examples of org.apache.james.protocols.smtp.SMTPResponse

    @Override
    protected SMTPResponse doCoreCmd(SMTPSession session, String command, String parameters) {
        StringBuilder result = new StringBuilder();
        result.append(DSNStatus.getStatus(DSNStatus.PERMANENT, DSNStatus.DELIVERY_INVALID_CMD)).append(" Command ").append(command).append(" unrecognized.");
        return new SMTPResponse(SMTPRetCode.SYNTAX_ERROR_COMMAND_UNRECOGNIZED, result);
    }
View Full Code Here

Examples of org.apache.james.protocols.smtp.SMTPResponse

     * Handler method called upon receipt of a NOOP command.
     * Just sends back an OK and logs the command.
     *
     */
    public Response onCommand(SMTPSession session, Request request) {
        return new SMTPResponse(SMTPRetCode.MAIL_OK, DSNStatus.getStatus(DSNStatus.SUCCESS,DSNStatus.UNDEFINED_STATUS)+" OK");
    }
View Full Code Here

Examples of org.apache.james.protocols.smtp.SMTPResponse

     * This method informs the client that the command is
     * not implemented.
     *
     */
    public Response onCommand(SMTPSession session, Request request) {
        return new SMTPResponse(SMTPRetCode.UNIMPLEMENTED_COMMAND,
                DSNStatus.getStatus(DSNStatus.PERMANENT,DSNStatus.SYSTEM_NOT_CAPABLE)+" VRFY is not supported");
    }
View Full Code Here

Examples of org.apache.james.protocols.smtp.SMTPResponse

     * process DATA command
     *
     */
    public Response onCommand(SMTPSession session, Request request) {
        String parameters = request.getArgument();
        SMTPResponse response = doDATAFilter(session,parameters);
       
        if (response == null) {
            return doDATA(session, parameters);
        } else {
            return response;
View Full Code Here

Examples of org.apache.james.protocols.smtp.SMTPResponse

    protected SMTPResponse doDATA(SMTPSession session, String argument) {
        MailEnvelope env = createEnvelope(session, (MailAddress) session.getState().get(SMTPSession.SENDER), new ArrayList<MailAddress>((Collection)session.getState().get(SMTPSession.RCPT_LIST)));
        session.getState().put(MAILENV, env);
        session.pushLineHandler(lineHandler);
       
        return new SMTPResponse(SMTPRetCode.DATA_READY, "Ok Send data ending with <CRLF>.<CRLF>");
    }
View Full Code Here

Examples of org.apache.james.protocols.smtp.SMTPResponse

        }
    }

    protected SMTPResponse doDATAFilter(SMTPSession session, String argument) {
        if ((argument != null) && (argument.length() > 0)) {
            return new SMTPResponse(SMTPRetCode.SYNTAX_ERROR_COMMAND_UNRECOGNIZED, DSNStatus.getStatus(DSNStatus.PERMANENT,DSNStatus.DELIVERY_INVALID_ARG)+" Unexpected argument provided with DATA command");
        }
        if (!session.getState().containsKey(SMTPSession.SENDER)) {
            return new SMTPResponse(SMTPRetCode.BAD_SEQUENCE, DSNStatus.getStatus(DSNStatus.PERMANENT,DSNStatus.DELIVERY_OTHER)+" No sender specified");
        } else if (!session.getState().containsKey(SMTPSession.RCPT_LIST)) {
            return new SMTPResponse(SMTPRetCode.BAD_SEQUENCE, DSNStatus.getStatus(DSNStatus.PERMANENT,DSNStatus.DELIVERY_OTHER)+" No recipients specified");
        }
        return null;
    }
View Full Code Here
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.