NAME
Mailmunge::Response - encapsulates response to send back to Milter.
ABSTRACT
Mailmunge::Response holds all of the information needed to reply to an SMTP connection request or SMTP command such as HELO, MAIL From: and RCPT To:
SYNOPSIS
use Mailmunge::Response;
sub filter_sender {
my ($self, $ctx) = @_;
# Everything's OK
return Mailmunge::Response->new(status => 'CONTINUE');
# Reject
return Mailmunge::Response->new(status => 'REJECT',
message => $ctx->sender . ' is unwelcome');
CLASS METHODS
Mailmunge::Response->new($key1 => $val1 [, $key2 => $val2...])
Creates a new Mailmunge::Response object. Arguments are a series of key => val pairs. Possible keys are:
- status
-
The status to return. This is one of the following strings:
- CONTINUE
-
Accept the SMTP command with a 2xx status code
- TEMPFAIL
-
Tempfail the SMTP command with a 4xx status code
- REJECT
-
Reject the SMTP command with a 5xx status code
- DISCARD
-
Accept the SMTP command, but discard the message rather than delivering it
- ACCEPT_AND_NO_MORE_FILTERING
-
Accept the SMTP command, and do no further filtering of the message.
- code
-
A 3-digit SMTP reply code. If not supplied, an appropriate code is picked based on the value of
status. - dsn
-
A 3-numbered SMTP DSN of the form "X.Y.Z". If not supplied, an appropriate DSN is picked based on the value of
status. - message
-
A text message to include in the SMTP reply. If not supplied, an appropriate message is picked based on the value of
status - delay
-
A delay in seconds; if non-zero,
mailmungewill pause for this many seconds before replying to the MTA. This parameter should be used with caution; if used at all, the delay should be at most a few seconds.
Mailmunge::Response->CONTINUE(...)
Equivalent to Mailmunge::Response->new(status => 'CONTINUE', ...)
Mailmunge::Response->ACCEPT_AND_NO_MORE_FILTERING(...)
Equivalent to Mailmunge::Response->new(status => 'ACCEPT_AND_NO_MORE_FILTERING', ...)
Mailmunge::Response->DISCARD(...)
Equivalent to Mailmunge::Response->new(status => 'DISCARD', ...)
Mailmunge::Response->TEMPFAIL(...)
Equivalent to Mailmunge::Response->new(status => 'TEMPFAIL', ...)
Mailmunge::Response->REJECT(...)
Equivalent to Mailmunge::Response->new(status => 'REJECT', ...)
INSTANCE METHODS
code([$val])
Returns the code value. If an argument is supplied, the code is set to that value.
dsn([$val])
Returns the dsn value. If an argument is supplied, the dsn is set to that value.
delay([$val])
Returns the delay value. If an argument is supplied, the delay is set to that value.
message([$val])
Returns the message value. If an argument is supplied, the message is set to that value.
status([$val])
Returns the status value. If an argument is supplied, the status is set to that value. If you supply an invalid status, then this method croaks.
fix_code_dsn()
Fix up the code and dsn members so they make sense for the given status. For example, if status is TEMPFAIL, then code must be 4xx and dsn must be 4.m.n.
is_tempfail()
Returns true if status is TEMPFAIL; false otherwise.
is_discard()
Returns true if status is DISCARD; false otherwise.
is_reject()
Returns true if status is REJECT; false otherwise.
is_success()
Returns true if status is CONTINUE or ACCEPT_AND_NO_MORE_FILTERING; false otherwise.
is_success_or_discard()
Returns true if status is CONTINUE, DISCARD or ACCEPT_AND_NO_MORE_FILTERING; false otherwise.
AUTHOR
Dianne Skoll <dianne@skollsoft.com>
LICENSE
This code is licensed under the terms of the GNU General Public License, version 2.
SEE ALSO
Mailmunge::Filter, Mailmunge::Context, mailmunge, mailmunge-multiplexor
Copyright © 2026 Skoll Software Consulting