Mailmunge::Response − encapsulates response to send back to Milter.
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:
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');
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, "mailmunge" will 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.
Equivalent to "Mailmunge::Response−>new(status => 'CONTINUE', ...)"
Equivalent to "Mailmunge::Response−>new(status => 'ACCEPT_AND_NO_MORE_FILTERING', ...)"
Equivalent to "Mailmunge::Response−>new(status => 'DISCARD', ...)"
Equivalent to "Mailmunge::Response−>new(status => 'TEMPFAIL', ...)"
Equivalent to "Mailmunge::Response−>new(status => 'REJECT', ...)"
Returns the "code" value. If an argument is supplied, the "code" is set to that value.
Returns the "dsn" value. If an argument is supplied, the "dsn" is set to that value.
Returns the "delay" value. If an argument is supplied, the "delay" is set to that value.
Returns the "message" value. If an argument is supplied, the "message" is set to that value.
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 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.
Returns true if "status" is TEMPFAIL; false otherwise.
Returns true if "status" is DISCARD; false otherwise.
Returns true if "status" is REJECT; false otherwise.
Returns true if "status" is CONTINUE or ACCEPT_AND_NO_MORE_FILTERING; false otherwise.
Returns true if "status" is CONTINUE, DISCARD or ACCEPT_AND_NO_MORE_FILTERING; false otherwise.
Dianne Skoll <[email protected]>
This code is licensed under the terms of the GNU General Public License, version 2.
Mailmunge::Filter, Mailmunge::Context, mailmunge, mailmunge−multiplexor