.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.16) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .el \{\ . de IX .. .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Sendmail::PMilter::Context 3pm" .TH Sendmail::PMilter::Context 3pm "2011-04-18" "perl v5.10.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Sendmail::PMilter::Context \- per\-connection milter context .SH "DESCRIPTION" .IX Header "DESCRIPTION" A Sendmail::PMilter::Context is the context object passed to milter callback functions as the first argument, typically named \*(L"$ctx\*(R" for convenience. This manual explains publicly accessible operations on \f(CW$ctx\fR. .SH "METHODS" .IX Header "METHODS" .ie n .IP "$ctx\->getpriv" 4 .el .IP "\f(CW$ctx\fR\->getpriv" 4 .IX Item "$ctx->getpriv" Returns the private data object for this milter instance, set by \&\f(CW$ctx\fR\->\fIsetpriv()\fR (see below). Returns undef if setpriv has never been called by this milter instance. .ie n .IP "$ctx\->getsymval(\s-1NAME\s0)" 4 .el .IP "\f(CW$ctx\fR\->getsymval(\s-1NAME\s0)" 4 .IX Item "$ctx->getsymval(NAME)" Retrieves the macro symbol named \s-1NAME\s0 from the macros available from the \s-1MTA\s0 for the current callback. This typically consists of a one-letter macro name, or a multi-letter macro name enclosed in {curly braces}. If the requested macro was not defined by the \s-1MTA\s0 ny the time getsymval is called, returns undef. .Sp Some common macros include the following. (Since milter is a protocol first implemented in the Sendmail \s-1MTA\s0, the macro names are the same as those in Sendmail itself.) .RS 4 .ie n .IP "$ctx\->getsymval('_')" 2 .el .IP "\f(CW$ctx\fR\->getsymval('_')" 2 .IX Item "$ctx->getsymval('_')" The remote host name and address, in standard \s-1SMTP\s0 \*(L"name [address]\*(R" form. .ie n .IP "$ctx\->getsymval('i')" 2 .el .IP "\f(CW$ctx\fR\->getsymval('i')" 2 .IX Item "$ctx->getsymval('i')" The \s-1MTA\s0's queue \s-1ID\s0 for the current message. .ie n .IP "$ctx\->getsymval('j')" 2 .el .IP "\f(CW$ctx\fR\->getsymval('j')" 2 .IX Item "$ctx->getsymval('j')" The \s-1MTA\s0's idea of local host name. .ie n .IP "$ctx\->getsymval('{if_addr}')" 2 .el .IP "\f(CW$ctx\fR\->getsymval('{if_addr}')" 2 .IX Item "$ctx->getsymval('{if_addr}')" The local address of the network interface upon which the connection was received. .ie n .IP "$ctx\->getsymval('{if_name}')" 2 .el .IP "\f(CW$ctx\fR\->getsymval('{if_name}')" 2 .IX Item "$ctx->getsymval('{if_name}')" The local hostname of the network interface upon which the connection was received. .ie n .IP "$ctx\->getsymval('{mail_addr}')" 2 .el .IP "\f(CW$ctx\fR\->getsymval('{mail_addr}')" 2 .IX Item "$ctx->getsymval('{mail_addr}')" The \s-1MAIL\s0 \s-1FROM:\s0 sender's address, canonicalized and angle bracket stripped. (This is typically not the same value as the second argument to the \&\*(L"envfrom\*(R" callback.) Will be defined to the empty string '' if the client issued a \s-1MAIL\s0 FROM:<> null return path command. .ie n .IP "$ctx\->getsymval('{rcpt_addr}')" 2 .el .IP "\f(CW$ctx\fR\->getsymval('{rcpt_addr}')" 2 .IX Item "$ctx->getsymval('{rcpt_addr}')" The \s-1RCPT\s0 \s-1TO:\s0 recipient's address, canonicalized and angle bracket stripped. (This is typically not the same value as the second argument to the \&\*(L"envrcpt\*(R" callback.) .RE .RS 4 .Sp Not all macros may be available at all times, of course. Some macros are only available after a specific phase is reached, and some macros may only be available from certain \s-1MTA\s0 implementations. Care should be taken to check for undef returns in order to cover these cases. .RE .ie n .IP "$ctx\->setpriv(\s-1DATA\s0)" 4 .el .IP "\f(CW$ctx\fR\->setpriv(\s-1DATA\s0)" 4 .IX Item "$ctx->setpriv(DATA)" This is the place to store milter-private data that is sensitive to the current \s-1SMTP\s0 client connection. Only one value can be stored, so typically an arrayref or hashref is initialized in the \*(L"connect\*(R" callback and set with \&\f(CW$ctx\fR\->setpriv. .Sp This value can be retrieved on subsequent callback runs with \f(CW$ctx\fR\->getpriv. .ie n .IP "$ctx\->setreply(\s-1RCODE\s0, \s-1XCODE\s0, \s-1MESSAGE\s0)" 4 .el .IP "\f(CW$ctx\fR\->setreply(\s-1RCODE\s0, \s-1XCODE\s0, \s-1MESSAGE\s0)" 4 .IX Item "$ctx->setreply(RCODE, XCODE, MESSAGE)" Set an extended \s-1SMTP\s0 status reply (before returning \s-1SMFIS_REJECT\s0 or \&\s-1SMFIS_TEMPFAIL\s0). \s-1RCODE\s0 should be a short (4xx or 5xx) numeric reply code, \&\s-1XCODE\s0 should be a long ('4.x.x' or '5.x.x') \s-1ESMTP\s0 reply code, and \s-1MESSAGE\s0 is the full text of the message to send. Example: .Sp .Vb 2 \& $ctx\->setreply(451, \*(Aq4.7.0\*(Aq, \*(AqCannot authenticate you right now\*(Aq); \& return SMFIS_TEMPFAIL; .Ve .Sp Note that after setting a reply with this method, the \s-1SMTP\s0 result code comes from \s-1RCODE\s0, not the difference between \s-1SMFIS_REJECT\s0 or \s-1SMFIS_TEMPFAIL\s0. However, for consistency, callbacks that set a 4xx response code should use \&\s-1SMFIS_TEMPFAIL\s0, and those that set a 5xx code should return \s-1SMFIS_REJECT\s0. .Sp Returns a true value on success, undef on failure. In the case of failure, typically only caused by bad parameters, a generic message will still be sent based on the SMFIS_* return code. .ie n .IP "$ctx\->\fIshutdown()\fR" 4 .el .IP "\f(CW$ctx\fR\->\fIshutdown()\fR" 4 .IX Item "$ctx->shutdown()" A special case of \f(CW\*(C`$ctx\->setreply()\*(C'\fR which sets the short numeric reply code to 421 and the \s-1ESMTP\s0 code to 4.7.0. Under Sendmail 8.13 and higher, this will close the \s-1MTA\s0's communication channel quickly, which should immediately result in a \*(L"close\*(R" callback and end of milter execution. (However, Sendmail 8.11\-8.12 will treat this as a regular 4xx error and will continue processing the message.) .Sp Always returns a true value. .Sp This method is an extension that is not available in the standard Sendmail::Milter package. .ie n .IP "$ctx\->addheader(\s-1HEADER\s0, \s-1VALUE\s0)" 4 .el .IP "\f(CW$ctx\fR\->addheader(\s-1HEADER\s0, \s-1VALUE\s0)" 4 .IX Item "$ctx->addheader(HEADER, VALUE)" Add header \s-1HEADER\s0 with value \s-1VALUE\s0 to this mail. Does not change any existing headers with the same name. Only callable from the \*(L"eom\*(R" callback. .Sp Returns a true value on success, undef on failure. .ie n .IP "$ctx\->addrcpt(\s-1ADDRESS\s0)" 4 .el .IP "\f(CW$ctx\fR\->addrcpt(\s-1ADDRESS\s0)" 4 .IX Item "$ctx->addrcpt(ADDRESS)" Add address \s-1ADDRESS\s0 to the list of recipients for this mail. Only callable from the \*(L"eom\*(R" callback. .Sp Returns a true value on success, undef on failure. .ie n .IP "$ctx\->chgheader(\s-1HEADER\s0, \s-1INDEX\s0, \s-1VALUE\s0)" 4 .el .IP "\f(CW$ctx\fR\->chgheader(\s-1HEADER\s0, \s-1INDEX\s0, \s-1VALUE\s0)" 4 .IX Item "$ctx->chgheader(HEADER, INDEX, VALUE)" Change the \s-1INDEX\s0'th header of name \s-1HEADER\s0 to the value \s-1VALUE\s0. Only callable from the \*(L"eom\*(R" callback. .Sp Returns a true value on success, undef on failure. .ie n .IP "$ctx\->delrcpt(\s-1ADDRESS\s0)" 4 .el .IP "\f(CW$ctx\fR\->delrcpt(\s-1ADDRESS\s0)" 4 .IX Item "$ctx->delrcpt(ADDRESS)" Remove address \s-1ADDRESS\s0 from the list of recipients for this mail. The \&\s-1ADDRESS\s0 argument must match a prior argument to the \*(L"envrcpt\*(R" callback exactly (case sensitive, and including angle brackets if present). Only callable from the \*(L"eom\*(R" callback. .Sp Returns a true value on success, undef on failure. A success return does not necessarily indicate that the recipient was successfully removed, but rather that the command was queued for processing. .ie n .IP "$ctx\->\fIprogress()\fR" 4 .el .IP "\f(CW$ctx\fR\->\fIprogress()\fR" 4 .IX Item "$ctx->progress()" Sends an asynchronous \*(L"progress\*(R" message to the \s-1MTA\s0, which should reset the \s-1MTA\s0's internal communications timer. This can allow longer than normal operations, such as a deliberate delay, to continue running without dropping the milter-MTA connection. This command can be issued at any time during any callback, although issuing it during a \*(L"close\*(R" callback may trigger socket connection warnings in Perl. .Sp Always returns a true value. .Sp This method is an extension that is not available in the standard Sendmail::Milter package. .ie n .IP "$ctx\->quarantine(\s-1REASON\s0)" 4 .el .IP "\f(CW$ctx\fR\->quarantine(\s-1REASON\s0)" 4 .IX Item "$ctx->quarantine(REASON)" Quarantine the current message in the MTA-defined quarantine area, using the given \s-1REASON\s0 as a text string describing the quarantine status. Only callable from the \*(L"eom\*(R" callback. .Sp Returns a true value on success, undef on failure. .Sp This method is an extension that is not available in the standard Sendmail::Milter package. .ie n .IP "$ctx\->replacebody(\s-1BUFFER\s0)" 4 .el .IP "\f(CW$ctx\fR\->replacebody(\s-1BUFFER\s0)" 4 .IX Item "$ctx->replacebody(BUFFER)" Replace the message body with the data in \s-1BUFFER\s0 (a scalar). This method may be called multiple times, each call appending to the replacement buffer. End-of-line should be represented by CR-LF (\*(L"\er\en\*(R"). Only callable from the \&\*(L"eom\*(R" callback. .Sp Returns a true value on success, undef on failure. .ie n .IP "$ctx\->setsender(\s-1ADDRESS\s0)" 4 .el .IP "\f(CW$ctx\fR\->setsender(\s-1ADDRESS\s0)" 4 .IX Item "$ctx->setsender(ADDRESS)" Replace the envelope sender address for the given mail message. This method provides an implementation to access the mlfi_setsender method added to the libmilter library as part of the mlfi-setsender project (http://www.sourceforge.net/projects/mlfi\-setsender). .Sp Returns a true value on success, undef on failure. A success return does not necessarily indicate that the recipient was successfully removed, but rather that the command was queued for processing. .SH "SEE ALSO" .IX Header "SEE ALSO" Sendmail::PMilter