.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (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 .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . 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 .\" ======================================================================== .\" .IX Title "Mail::MIMEDefang 3" .TH Mail::MIMEDefang 3 2024-03-20 3.4.1 "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 "Milter" API, 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 UTF\-8 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 HTML 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 "%XY" 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 "%XY" 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 RESULTS file. .Sp \&\f(CW$cmd\fR should be a one-letter command for the RESULTS 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 "\-odd"). .IP "send_admin_mail(subject, body)" 4 .IX Item "send_admin_mail(subject, body)" Sends a mail message to the administrator .SS "SEE ALSO" .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)