@Override public void execute(String commandString, ConnectionContext context) throws IOException { context.sendResponse("502 VRFY command is disabled"); } }
@Override public void execute(String commandString, ConnectionContext context) throws IOException { context.sendResponse("250 Ok"); } }
@Override public void execute(String commandString, ConnectionContext context) throws IOException { context.sendResponse("221 Bye"); context.getSession().quit(); } }
@Override public void execute(String commandString, ConnectionContext context) throws IOException { String args = getArgPredicate(commandString); if ("".equals(args)) { context.sendResponse(getCommandMessage((SMTPServer)context.getServer())); return; } try { context.sendResponse(getHelp(args).toOutputString()); } catch (CommandException e) { context.sendResponse("504 HELP topic \"" + args + "\" unknown."); } }
@Override public void execute(String commandString, ConnectionContext context) throws IOException { String[] args = getArgs(commandString); if (args.length < 2) { context.sendResponse("501 Syntax: HELO <hostname>"); return; } Session session = context.getSession(); session.setHasSeenHelo(true); context.sendResponse("250 " + context.getServer().getHostName()); } }
@Override public void execute(String commandString, ConnectionContext context) throws IOException { Session session = context.getSession(); session.reset(session.getHasSeenHelo()); context.sendResponse("250 Ok"); } }
context.sendResponse("501 Syntax error (no parameters allowed)"); return; if (socket instanceof SSLSocket) context.sendResponse("454 TLS not available due to temporary reason: TLS already active"); return; context.sendResponse("220 Ready to start TLS");
if (!session.getHasSeenHelo()) context.sendResponse("503 Error: send HELO/EHLO first"); context.sendResponse("503 Sender already specified."); context.sendResponse("501 Syntax: MAIL FROM: <address>"); return; if (!args.toUpperCase().startsWith("FROM:")) context.sendResponse( "501 Syntax: MAIL FROM: <address> Error in parameters: \"" + getArgPredicate(commandString) + "\""); context.sendResponse("250 Ok"); context.sendResponse(ex.getMessage()); context.sendResponse("553 <" + emailAddress + "> Invalid email address.");
public void handleCommand(ConnectionContext context, String commandString) throws SocketTimeoutException, IOException { try { Command command = getCommandFromString(commandString); command.execute(commandString, context); } catch (CommandException e) { context.sendResponse("500 " + e.getMessage()); } }
context.sendResponse("503 Refusing any other AUTH command."); return; context.sendResponse("501 Syntax: " + VERB + " mechanism [initial-response]"); return; .sendResponse("504 The requested authentication mechanism is not supported"); return; context.sendResponse(response.toString()); context.sendResponse("501 Authentication canceled by client."); return; context.sendResponse(response.toString()); context.sendResponse("235 Authentication successful."); context.getSession().setAuthenticated(true); context.sendResponse("535 Authentication failure."); context.getSession().setAuthenticated(false);
if (!session.getHasSender()) context.sendResponse("503 Error: need MAIL command"); return; context.sendResponse("452 Error: too many recipients"); return; if (!args.toUpperCase().startsWith("TO:")) context.sendResponse( "501 Syntax: RCPT TO: <address> Error in parameters: \"" + args + "\""); context.sendResponse("250 Ok"); context.sendResponse(ex.getMessage());
context.sendResponse("503 Error: need MAIL command"); return; context.sendResponse("503 Error: need RCPT command"); return; context.sendResponse("354 End data with <CR><LF>.<CR><LF>"); session.setDataMode(true); context.sendResponse("250 Ok"); context.sendResponse(ex.getMessage());
if (args.length < 2) context.sendResponse("501 Syntax: EHLO hostname"); return; context.sendResponse(response); context.sendResponse("503 " + remoteHost + " Duplicate EHLO");