.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" 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" '' . ds C` . ds C' '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 >0, 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. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" 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 "Mail::MIMEDefang 3" .TH Mail::MIMEDefang 3 "2023-01-30" "3.3" "Mail::MIMEDefang 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" Mail::MIMEDefang \- email filtering milter .SH "DESCRIPTION" .IX Header "DESCRIPTION" Mail::MIMEDefang is a framework for filtering e\-mail. It uses Sendmail's \*(L"Milter\*(R" \s-1API,\s0 some C glue code, and some Perl code to let you write high-performance mail filters in Perl. .PP People use MIMEDefang to: .PP .Vb 7 \& Block viruses \& Block or tag spam \& Remove HTML mail parts \& Add boilerplate disclaimers to outgoing mail \& Remove or alter attachments \& Replace attachments with URL\*(Aqs \& Implement sophisticated access controls. .Ve .PP You're limited only by your imagination. If you can think of it and code it in Perl, you can do it with MIMEDefang. .SH "METHODS" .IX Header "METHODS" .IP "init_globals" 4 .IX Item "init_globals" Initialize global variables used across MIMEDefang instance and filter. .IP "print_and_flush(text)" 4 .IX Item "print_and_flush(text)" Prints to stdout and flush buffer. .IP "md_openlog(tag, facility)" 4 .IX Item "md_openlog(tag, facility)" Initialize e syslog object using Sys::Syslog or Unix::Syslog as appropriate. .IP "md_syslog(facility, msg)" 4 .IX Item "md_syslog(facility, msg)" Prints a message to \fBsyslog\fR\|(3) using the specified facility .IP "md_graphdefang_log" 4 .IX Item "md_graphdefang_log" This is called to log events that occur during mimedefang processing. It should be called from mimedefang-filter with appropriate event names and values. .Sp Possible examples: .Sp \&\f(CW\*(C`md_graphdefang_log(\*(Aqvirus\*(Aq,$VirusName,$filename);\*(C'\fR .Sp \&\f(CW\*(C`md_graphdefang_log(\*(Aqspam\*(Aq,$hits);\*(C'\fR .Sp \&\f(CW\*(C`md_graphdefang_log(\*(Aqbad_filename\*(Aq,$filename,$extension);\*(C'\fR .Sp If you need to log \s-1UTF\-8\s0 strings you can call the sub as: .Sp \&\f(CW\*(C`md_graphdefang_log(\*(Aqspam\*(Aq,$hits, undef, 1);\*(C'\fR .IP "detect_and_load_perl_modules" 4 .IX Item "detect_and_load_perl_modules" Automatically detect and load Perl modules needed for some features like SpamAssassin, rbl checks, zip file listing and \s-1HTML\s0 parsing. .IP "detect_antivirus_support" 4 .IX Item "detect_antivirus_support" Check if antivirus support should be loaded by looking at \f(CW%Features\fR .IP "init_status_tag" 4 .IX Item "init_status_tag" Open the status file descriptor .IP "set_status_tag(depth, tag)" 4 .IX Item "set_status_tag(depth, tag)" Sets the status tag for this worker inside the multiplexor. .IP "push_status_tag(tag)" 4 .IX Item "push_status_tag(tag)" Updates status tag inside multiplexor and pushes onto stack. .IP "pop_status_tag" 4 .IX Item "pop_status_tag" Pops previous status of stack and sets tag in multiplexor. .IP "percent_encode(str)" 4 .IX Item "percent_encode(str)" Encode a string with unsafe chars as \*(L"%XY\*(R" where X and Y are hex digits. .IP "percent_encode_for_graphdefang(str)" 4 .IX Item "percent_encode_for_graphdefang(str)" Encode a string with unsafe chars as \*(L"%XY\*(R" where X and Y are hex digits. .Sp Quotes or spaces are not encoded but commas are encoded. .IP "percent_decode(str)" 4 .IX Item "percent_decode(str)" Decode a string previously encoded by \fBpercent_encode()\fR. .ie n .IP "write_result_line ( $cmd, @args )" 4 .el .IP "write_result_line ( \f(CW$cmd\fR, \f(CW@args\fR )" 4 .IX Item "write_result_line ( $cmd, @args )" Writes a result line to the \s-1RESULTS\s0 file. .Sp \&\f(CW$cmd\fR should be a one-letter command for the \s-1RESULTS\s0 file .Sp \&\f(CW@args\fR are the arguments for \f(CW$cmd\fR, if any. They will be \fBpercent_encode()\fR'ed before being written to the file. .Sp Returns 0 or 1 and an optional warning message. .IP "signal_unchanged" 4 .IX Item "signal_unchanged" Tells mimedefang C program message has not been altered. .IP "signal_changed" 4 .IX Item "signal_changed" Tells mimedefang C program message has been altered. .IP "in_message_context(name)" 4 .IX Item "in_message_context(name)" Returns 1 if we are processing a message; 0 otherwise. .IP "in_filter_wrapup(name)" 4 .IX Item "in_filter_wrapup(name)" Returns 1 if we are not in filter wrapup; 0 otherwise. .IP "in_filter_context" 4 .IX Item "in_filter_context" Returns 1 if we are inside filter or filter_multipart, 0 otherwise. .IP "in_filter_end(name)" 4 .IX Item "in_filter_end(name)" Returns 1 if we are inside filter_end 0 otherwise. .IP "send_quarantine_notifications" 4 .IX Item "send_quarantine_notifications" Sends quarantine notification message, if anything was quarantined. .IP "signal_complete" 4 .IX Item "signal_complete" Tells mimedefang C program Perl filter has finished successfully. .Sp Also mails any quarantine notifications and sender notifications. .IP "send_mail(fromAddr, fromFull, recipient, body, deliverymode)" 4 .IX Item "send_mail(fromAddr, fromFull, recipient, body, deliverymode)" Sends a mail message using Sendmail. .Sp Invokes Sendmail without involving the shell, so that shell metacharacters won't cause security problems. .Sp Delivery mode parameter is the optional sendmail delivery mode arg (default \*(L"\-odd\*(R"). .IP "send_admin_mail(subject, body)" 4 .IX Item "send_admin_mail(subject, body)" Sends a mail message to the administrator .SS "\s-1SEE ALSO\s0" .IX Subsection "SEE ALSO" \&\fBMail::MIMEDefang::Actions\fR\|(3) .PP \&\fBMail::MIMEDefang::Antispam\fR\|(3) .PP \&\fBMail::MIMEDefang::Antivirus\fR\|(3) .PP \&\fBMail::MIMEDefang::DKIM\fR\|(3) .PP \&\fBMail::MIMEDefang::DKIM::ARC\fR\|(3) .PP \&\fBMail::MIMEDefang::DKIM::Authres\fR\|(3) .PP \&\fBMail::MIMEDefang::Mail\fR\|(3) .PP \&\fBMail::MIMEDefang::MIME\fR\|(3) .PP \&\fBMail::MIMEDefang::Net\fR\|(3) .PP \&\fBMail::MIMEDefang::RFC2822\fR\|(3) .PP \&\fBMail::MIMEDefang::Unit\fR\|(3) .PP \&\fBMail::MIMEDefang::Utils\fR\|(3)