/** * Handler method called upon receipt of a QUIT command. This method informs * the client that the connection is closing. * * @param session * SMTP session object * @param argument * the argument passed in with the command by the SMTP client */ private Response doQUIT(SMTPSession session, String argument) { if ((argument == null) || (argument.length() == 0)) { StringBuilder response = new StringBuilder(); response.append( DSNStatus.getStatus(DSNStatus.SUCCESS, DSNStatus.UNDEFINED_STATUS)).append(" ").append( session.getConfiguration().getHelloName()).append( " Service closing transmission channel"); SMTPResponse ret = new SMTPResponse(SMTPRetCode.SYSTEM_QUIT, response); ret.setEndSession(true); return ret; } else { return SYNTAX_ERROR; } }
response.setEndSession(true); response.setEndSession(true); return response;
/** * Convert the HookResult to SMTPResponse using default values. Should be override for using own values * * @param result HookResult * @return SMTPResponse */ public static SMTPResponse calcDefaultSMTPResponse(HookResult result) { if (result != null) { HookReturnCode returnCode = result.getResult(); String smtpReturnCode = OptionalUtils.or( Optional.ofNullable(result.getSmtpRetCode()), retrieveDefaultSmtpReturnCode(returnCode)) .orElse(null); String smtpDescription = OptionalUtils.or( Optional.ofNullable(result.getSmtpDescription()), retrieveDefaultSmtpDescription(returnCode)) .orElse(null); if (canBeConvertedToSmtpAnswer(returnCode)) { SMTPResponse response = new SMTPResponse(smtpReturnCode, smtpDescription); if (returnCode.isDisconnected()) { response.setEndSession(true); } return response; } } return null; }