From 1e86299bf8c7435becc32578fa827ae54f7b1a52 Mon Sep 17 00:00:00 2001 From: Matt Sergeant Date: Tue, 24 Jun 2003 07:42:38 +0000 Subject: [PATCH] Added DISCARD option to DATA (body) checks Added documentation to Constants.pm git-svn-id: https://svn.perl.org/qpsmtpd/trunk@158 958fd67b-6ff1-0310-b445-bb7760255be9 --- lib/Qpsmtpd/Constants.pm | 45 ++++++++++++++++++++++++++++++++++++---- lib/Qpsmtpd/SMTP.pm | 3 +++ 2 files changed, 44 insertions(+), 4 deletions(-) diff --git a/lib/Qpsmtpd/Constants.pm b/lib/Qpsmtpd/Constants.pm index ec9a1c2..5fd90f2 100644 --- a/lib/Qpsmtpd/Constants.pm +++ b/lib/Qpsmtpd/Constants.pm @@ -2,7 +2,7 @@ package Qpsmtpd::Constants; use strict; require Exporter; -my (@common) = qw(OK DECLINED DONE DENY DENYSOFT TRACE); +my (@common) = qw(OK DECLINED DONE DENY DENYSOFT TRACE DISCARD); use vars qw($VERSION @ISA @EXPORT); @ISA = qw(Exporter); @@ -15,6 +15,7 @@ use constant DENY => 901; use constant DENYSOFT => 902; use constant DECLINED => 909; use constant DONE => 910; +use constant DISCARD => 920; 1; @@ -22,9 +23,45 @@ use constant DONE => 910; =head1 NAME -Qpsmtpd::Constants - Constants should be defined here +Qpsmtpd::Constants - Constants for plugins to use -=head1 SYNOPSIS +=head1 CONSTANTS -Not sure if we are going to use this... +Constants available: +=over 4 + +=item C + +Return this only from the queue phase to indicate the mail was queued +successfully. + +=item C + +Returning this from a hook causes a 5xx error (hard failure) to be +returned to the connecting client. + +=item C + +Returning this from a hook causes a 4xx error (temporary failure - try +again later) to be returned to the connecting client. + +=item C + +Returning this from a hook implies success, but tells qpsmtpd to go +on to the next plugin. + +=item C + +Returning this from a hook implies success, but tells qpsmtpd to +skip any remaining plugins for this phase. + +=item C + +This can only be returned for the DATA phase. It tells qpsmtpd to +return 250 to the client implying delivery success, but silently +drops the email. + +=back + +=cut diff --git a/lib/Qpsmtpd/SMTP.pm b/lib/Qpsmtpd/SMTP.pm index 869b75e..759d46a 100644 --- a/lib/Qpsmtpd/SMTP.pm +++ b/lib/Qpsmtpd/SMTP.pm @@ -403,6 +403,9 @@ sub data { elsif ($rc == DENYSOFT) { $self->respond(452, $msg || "Message denied temporarily"); } + elsif ($rc == DISCARD) { + $self->respond(250, $msg || "Message quietly discarded"); + } else { $self->queue($self->transaction); }