private Optional<String> retrieveDefaultSmtpDescription(HookReturnCode returnCode) { switch (returnCode.getAction()) { case DENY: return Optional.of("Authentication Failed"); case DENYSOFT: return Optional.of("Temporary problem. Please try again later"); case OK: return Optional.of("Authentication Succesfull"); case DECLINED: case NONE: break; } return Optional.empty(); }
private Optional<String> retrieveDefaultSmtpReturnCode(HookReturnCode returnCode) { switch (returnCode.getAction()) { case DENY: return Optional.of(SMTPRetCode.AUTH_FAILED); case DENYSOFT: return Optional.of(SMTPRetCode.LOCAL_ERROR); case OK: return Optional.of(SMTPRetCode.AUTH_OK); case DECLINED: case NONE: break; } return Optional.empty(); }
public static boolean canBeConvertedToSmtpAnswer(HookReturnCode returnCode) { return HookReturnCode.Action.ACTIVE_ACTIONS .contains(returnCode.getAction()) || returnCode.isDisconnected(); }
public void increment(HookReturnCode code) { switch (code.getAction()) { case DECLINED: declined.incrementAndGet(); break; case DENY: deny.incrementAndGet(); break; case DENYSOFT: denysoft.incrementAndGet(); break; case OK: ok.incrementAndGet(); break; case NONE: break; } all.incrementAndGet(); }
private static Optional<String> retrieveDefaultSmtpReturnCode(HookReturnCode returnCode) { switch (returnCode.getAction()) { case DENY: return Optional.of(SMTPRetCode.TRANSACTION_FAILED); case DENYSOFT: return Optional.of(SMTPRetCode.LOCAL_ERROR); case OK: return Optional.of(SMTPRetCode.MAIL_OK); case DECLINED: case NONE: break; } if (returnCode.isDisconnected()) { return Optional.of(SMTPRetCode.TRANSACTION_FAILED); } return Optional.empty(); }
@Override public HookResult onHookResult(SMTPSession session, HookResult hResult, long executionTime, Hook hook) { HookReturnCode result = hResult.getResult(); boolean requiresInfoLogging = result.getAction() == HookReturnCode.Action.DENY || result.getAction() == HookReturnCode.Action.DENYSOFT || result.isDisconnected(); if (requiresInfoLogging) { LOGGER.info("{}: result= ({} {})", hook.getClass().getName(), result.getAction(), result.getConnectionStatus()); } else { LOGGER.debug("{}: result= ({} {})", hook.getClass().getName(), result.getAction(), result.getConnectionStatus()); } return hResult; }
private static Optional<String> retrieveDefaultSmtpDescription(HookReturnCode returnCode) { switch (returnCode.getAction()) { case DENY: return Optional.of("Email rejected"); case DENYSOFT: return Optional.of("Temporary problem. Please try again later"); case OK: return Optional.of("Command accepted"); case DECLINED: case NONE: break; } if (returnCode.isDisconnected()) { return Optional.of("Server disconnected"); } return Optional.empty(); }
if (hRes.getResult().getAction() == HookReturnCode.Action.OK) { final Response response = doCoreCmd(session, command, parameters); if (hRes.getResult().isDisconnected()) {
.orElse(null); if (HookReturnCode.Action.ACTIVE_ACTIONS.contains(returnCode.getAction())) { SMTPResponse response = new SMTPResponse(smtpReturnCode, smtpDescription);