8 use Time
::HiRes qw
(gettimeofday tv_interval
);
9 use POSIX
qw(:sys_wait_h errno_h signal_h);
13 use Net
::Server
::PreFork
;
14 use Net
::Server
::SIG
qw(register_sig check_sigs);
25 use Mail
::SpamAssassin
;
26 use Mail
::SpamAssassin
::NetSet
;
46 use base
qw(Net::Server::PreFork);
48 my $opt_commandline = [$0, @ARGV];
49 my $opt_max_dequeue = 1;
50 my $opt_dequeue_time = 60*2;
52 my $opt_ext_port = 10024;
53 my $opt_int_port = 10023;
54 my $opt_inject_port = 10025;
61 my $prog_name = 'pmg-smtp-filter';
63 initlog
($prog_name, 'mail');
65 if (!GetOptions
('testmode=s' => \
$opt_testmode,
66 'pidfile=s' => \
$opt_pidfile,
67 'untrusted' => \
$opt_untrusted,
68 'database=s' => \
$opt_database)) {
73 $opt_pidfile = "/var/run/${prog_name}.pid" if !$opt_pidfile;
77 my $min_spare_servers = 0;
78 my $max_spare_servers = 0;
83 my $pmg_cfg = PMG
::Config-
>new();
85 my $demo = $pmg_cfg->get('administration', 'demo');
88 syslog
('info', 'demo mode detected - not starting server');
92 $max_servers = $pmg_cfg->get('mail', 'max_filters') + 2;
94 $min_spare_servers = 1;
95 $max_spare_servers = 4;
99 $opt_max_dequeue = 0 if $opt_testmode;
102 if (defined ($ENV{BOUND_SOCKETS
})) {
107 port
=> [ $opt_int_port, $opt_ext_port ],
109 min_servers
=> $min_servers,
110 max_servers
=> $max_servers,
111 min_spare_servers
=> $min_spare_servers,
112 max_spare_servers
=> $max_spare_servers,
113 max_requests
=> $max_requests,
114 serialize
=> 'flock',
115 max_dequeue
=> $opt_max_dequeue,
116 check_for_dequeue
=> $opt_dequeue_time,
118 pid_file
=> $opt_pidfile,
119 no_close_by_child
=> 1,
120 no_client_stdout
=> 1,
121 commandline
=> $opt_commandline,
124 $server_attr->{setsid
} = $daemonize if !$opt_testmode;
128 if (defined($opt_database)) {
129 $database = $opt_database;
131 $database = $opt_testmode ?
"Proxmox_testdb" : "Proxmox_ruledb";
134 $SIG{'__WARN__'} = sub {
138 syslog
('warning', "WARNING: %s", $t);
143 my ($self, $queue, $entity, $msginfo, $rule, $targets, $spaminfo) = @_;
146 sa_score
=> $queue->{sa_score
},
147 sa_hits
=> $queue->{sa_hits
},
148 sa_data
=> $queue->{sa_data
},
149 sa_max
=> $queue->{sa_max
}
153 'SUBJECT' => $entity->head->get ('subject', 0) || 'No Subject',
154 'RULE' => $rule->{name
},
155 'RULE_INFO' => $msginfo->{rule_info
},
156 'SENDER' => $msginfo->{sender
},
157 'SENDER_IP' => $msginfo->{xforward
}->{addr
},
158 'TARGETS' => join (', ', @$targets),
159 'RECEIVERS' => join (', ', @{$msginfo->{targets
}}),
160 'SPAMLEVEL' => $spaminfo->{sa_score
},
161 'SPAMSTARS' => '*' x
(($spaminfo->{sa_score
} || 0) > 100 ?
100 : $spaminfo->{sa_score
} || 0),
162 'ADMIN' => $self->{pmg_cfg
}->get('administration', 'email'),
163 'HOST' => $msginfo->{hostname
},
164 'DOMAIN' => $msginfo->{domain
},
165 'FQDN' => $msginfo->{fqdn
},
166 'MSGID' => $queue->{msgid
},
167 'VERSION' => PMG
::pmgcfg
::package() . "/" . PMG
::pmgcfg
::version
() . "/" . PMG
::pmgcfg
::repoid
(),
170 $vars->{__spaminfo
} = $spaminfo;
173 if ($queue->{vinfo_clam
}) {
174 $vars->{'VIRUS_INFO'} = "Virus Info:";
175 $vars->{'VIRUS_INFO'} .= " clam: $queue->{vinfo_clam}" if $queue->{vinfo_clam
};
177 $vars->{'VIRUS_INFO'} = '';
180 if ($queue->{vinfo
}) {
181 $vars->{'VIRUS_INFO'} = "Virus Info: $queue->{vinfo}\n";
183 $vars->{'VIRUS_INFO'} = '';
187 $vars->{'SPAM_HITS'} = $spaminfo->{sa_hits
};
189 $vars->{'SPAM_INFO'} = '';
190 my $sscores = $spaminfo->{sa_data
};
192 if (defined ($sscores) && @$sscores != -1) {
195 $sa_text = "Spam detection results: 100\n";
197 $sa_text = "Spam detection results: $spaminfo->{sa_score}\n";
200 foreach my $s (@$sscores) {
202 $sa_text .= sprintf ("%-22s %6s %s\n", $s->{rule
},
203 1, $s->{desc
} || '-');
205 $sa_text .= sprintf ("%-22s %6s %s\n", $s->{rule
},
206 $s->{score
}, $s->{desc
} || '-');
209 $vars->{'SPAM_INFO'} = $sa_text;
213 delete ($vars->{'ADMIN'});
214 #delete ($vars->{'SPAM_INFO'});
221 my ($self, $queue, $msginfo, $entity, $ldap) = @_;
227 my $matching_rules = [];
229 my $rulecache = $self->{rulecache
};
230 my $rules = $rulecache->rules ();
231 my $dbh = $self->{ruledb
}->{dbh
};
233 # first, we remove all conditional written 'X-' header attributes
234 foreach my $rule (@$rules) {
235 next if !$rule->{active
};
236 next if ($rule->{direction
} == 0) && $msginfo->{trusted
};
237 next if ($rule->{direction
} == 1) && !$msginfo->{trusted
};
239 my $actions = $rulecache->get_actions ($rule->{id
});
241 foreach my $action (@$actions) {
242 if ($action->isa ("PMG::RuleDB::ModField")) {
243 my $fname = $action->{field
};
244 next if $fname !~ m/^X-/i;
245 $entity->head->delete($fname);
251 foreach my $rule (@$rules) {
252 next if !$rule->{active
};
253 next if ($rule->{direction
} == 0) && $msginfo->{trusted
};
254 next if ($rule->{direction
} == 1) && !$msginfo->{trusted
};
256 # match from, when and what classes (not target dependent)
257 if (!($rulecache->from_match ($rule->{id
}, $msginfo->{sender
}, $msginfo->{xforward
}->{addr
}, $ldap) &&
258 $rulecache->when_match ($rule->{id
}, time))) {
262 $rule_marks{$rule->{id
}} =
263 $rulecache->what_match ($rule->{id
}, $queue, $entity, $msginfo, $dbh);
265 $rule_actions{$rule->{id
}} = $rulecache->get_actions ($rule->{id
});
266 my $fin = $rulecache->final ($rule->{id
});
269 foreach my $target (@{$msginfo->{targets
}}) {
270 next if $final->{$target};
271 next if !defined ($rule_marks{$rule->{id
}});
272 next if !defined ($rule_marks{$rule->{id
}}->{$target});
273 next if !defined ($rule_marks{$rule->{id
}}->{$target}->{marks
});
274 next if !$rulecache->to_match ($rule->{id
}, $target, $ldap);
276 $final->{$target} = $fin;
278 push @{$rule_targets{$rule->{id
}}}, $target;
282 # Compute rule_info (summary about matching rule)
283 # this can be used for debugging
285 foreach my $rule (@$rules) {
286 next if !$rule_targets{$rule->{id
}};
288 push @$matching_rules, $rule->{id
};
290 $rule_info .= "Rule: $rule->{name}\n";
292 foreach my $target (@{$rule_targets{$rule->{id
}}}) {
293 $rule_info .= " Receiver: $target\n";
295 foreach my $action (@{$rule_actions{$rule->{id
}}}) {
296 $rule_info .= " Action: " . $action->short_desc () . "\n";
300 $msginfo->{rule_info
} = $rule_info;
302 if ($msginfo->{testmode
}) {
303 my $vars = $self->get_prox_vars ($queue, $entity, $msginfo, undef, [], undef);
304 my $out = "__RULE_INFO__";
305 $out = PMG
::Utils
::subst_values
($out, $vars);
306 my $fh = $msginfo->{test_fh
};
312 my $mod_group = PMG
::ModGroup-
>new($entity, $msginfo->{targets
});
314 foreach my $rule (@$rules) {
315 my $targets = $rule_targets{$rule->{id
}};
319 foreach my $t (@$targets) {
320 if ($rule_marks{$rule->{id
}}->{$t} && $rule_marks{$rule->{id
}}->{$t}->{spaminfo
}) {
321 $spaminfo = $rule_marks{$rule->{id
}}->{$t}->{spaminfo
};
322 # we assume spam info is the same for all matching targets
327 my $vars = $self->get_prox_vars ($queue, $entity, $msginfo, $rule,
328 $rule_targets{$rule->{id
}}, $spaminfo);
332 sort {$a->priority <=> $b->priority} @{$rule_actions{$rule->{id
}}};
334 foreach my $action (@sorted_actions) {
335 $action->execute ($queue, $self->{ruledb
}, $mod_group,
336 $rule_targets{$rule->{id
}},
337 $msginfo, $vars, $rule_marks{$rule->{id
}}->{marks
}, $ldap);
338 last if $action->final;
342 # we deliver all mail not matched by any rule
343 # (default action = accept)
345 foreach my $target (@{$msginfo->{targets
}}) {
346 next if $final->{$target};
348 push @$unmatched, $target;
352 my $accept = PMG
::RuleDB
::Accept-
>new ();
353 $accept->execute ($queue, $self->{ruledb
}, $mod_group, $unmatched,
354 $msginfo, undef, undef, undef);
357 return $matching_rules;
360 # reload ruledb and pmg config
363 my $prop = $self->{server
};
365 if ($self->{ruledb
}) {
366 $self->log (0, "reloading configuration $database");
367 $self->{ruledb
}->close ();
370 $self->{pmg_cfg
} = PMG
::Config-
>new();
371 $self->{cinfo
} = PVE
::INotify
::read_file
("cluster.conf");
374 my $dbh = PMG
::DBTools
::open_ruledb
($database);
375 $self->{ruledb
} = PMG
::RuleDB-
>new ($dbh);
378 $self->{rulecache
} = PMG
::RuleCache-
>new ($self->{ruledb
});
384 sleep (10); # reduce restart rate when postgres is down
389 $self->{ldap
} = PMG
::LDAPSet-
>new_from_pmg_cfg($self->{pmg_cfg
}, 1);
391 $self->{reload_config
} = 0;
403 my ($self, $level, $msg, @therest) = @_;
404 my $prop = $self->{server
};
406 return if $level =~ /^\d+$/ && $level > $prop->{log_level
};
408 $level = $syslog_map->{$level} || $level;
410 syslog
($level, $msg, @therest);
412 syslog
($level, $msg);
418 my $prop = $self->{server
};
420 $prop->{log_level
} = 3;
422 $self->log (0, "Filter daemon (re)started (max. $max_servers processes)");
424 eval { PMG
::MailQueue
::cleanup_active
(); };
425 $self->log (0, "Cleanup failures: $@") if $@;
427 my $sig_set = POSIX
::SigSet-
>new;
428 $sig_set->addset (&POSIX
::SIGHUP
);
429 $sig_set->addset (&POSIX
::SIGCHLD
);
430 my $old_sig_set = POSIX
::SigSet-
>new();
432 sigprocmask
(SIG_UNBLOCK
, $sig_set, $old_sig_set);
434 my ($backup_umask) = umask;
436 my $pmg_cfg = PMG
::Config-
>new();
438 # Note: you need to restart the daemon when you change 'rbl_checks'
439 my $rbl_checks = $pmg_cfg->get('spam', 'rbl_checks');
441 $self->{sa
} = Mail
::SpamAssassin-
>new ({
443 local_tests_only
=> $opt_testmode || !$rbl_checks,
444 home_dir_for_helpers
=> '/root',
445 userstate_dir
=> '/root/.spamassassin',
446 dont_copy_prefs
=> 1,
447 stop_at_threshold
=> 0,
450 $self->{sa
}->compile_now;
452 alarm (0); # SA forgets to clear alarm in some cases
453 umask ($backup_umask);
454 initlog
($prog_name, 'mail');
457 # reloading server configuration
458 if (defined $prop->{children
}) {
459 foreach my $pid (keys %{$prop->{children
}}) {
460 kill (10, $pid); # SIGUSR1 childs
466 sub child_init_hook
{
469 $0 = "$prog_name child";
471 # $self->log (3, "init child");
474 $self->load_config ();
479 $self->child_finish_hook;
484 $self->{reload_config
} = 1;
488 sub child_finish_hook
{
491 # $self->log (3, "finish child");
492 $self->{ruledb
}->close () if $self->{ruledb
};
498 # do database maintainance here
500 $self->log (2, "starting database maintainance");
502 my ($csec, $usec) = gettimeofday
();
504 my $cinfo = PVE
::INotify
::read_file
("cluster.conf");
509 $dbh = PMG
::DBTools
::open_ruledb
($database);
514 $self->log (0, msgquote
("ERROR: $err"));
519 PMG
::Statistic
::update_stats
($dbh, $cinfo);
523 my ($csec_end, $usec_end) = gettimeofday
();
524 my $ptime = int (($csec_end-$csec)*1000 + ($usec_end - $usec)/1000);
527 $self->log (0, msgquote
($err));
529 $self->log (2, "end database maintainance ($ptime ms)");
532 $dbh->disconnect() if $dbh;
537 my ($self, $unpack, $entity, $msginfo, $queue) = @_;
542 if (($magic = $entity->{PMX_magic_ct
}) &&
543 ($path = $entity->{PMX_decoded_path
})) {
545 my $filename = basename
($path);
547 if (PMG
::Unpack
::is_archive
($magic)) {
548 $self->log (3, "$queue->{logid}: found archive '$filename' ($magic)");
550 my $start = [gettimeofday
];
552 $unpack->{mime
} = {};
555 $unpack->unpack_archive ($path, $magic);
558 $self->log (3, "$queue->{logid}: unpack failed - $@") if $@;
560 $entity->{PMX_content_types
} = $unpack->{mime
};
563 my $types = join (", ", sort keys (%{$entity->{PMX_content_types
}}));
564 my $fh = $msginfo->{test_fh
};
565 $filename =~ s/\d+/X/g if $filename =~ m/^msg-\d+-\d+.msg/;
566 print $fh "Types:$filename: $types\n" if $types;
569 my $elapsed = int(tv_interval
($start) * 1000);
571 $self->log (3, "$queue->{logid}: unpack archive '$filename' done ($elapsed ms)");
575 foreach my $part ($entity->parts) {
576 $self->unpack_entity ($unpack, $part, $msginfo, $queue);
582 my ($self, $smtp) = @_;
584 my ($csec, $usec) = gettimeofday
();
588 my $pmg_cfg = $self->{pmg_cfg
};
589 my $ldap = $self->{ldap
};
590 my $cinfo = $self->{cinfo
};
591 my $lcid = $cinfo->{local}->{cid
};
593 $msginfo->{test_fh
} = PMG
::AtomicFile-
>new("testresult.out", "w")
596 $msginfo->{trusted
} = $self->{trusted
};
599 # PHASE 1 - save incoming mail (already done)
602 $queue = $smtp->{queue
};
603 $queue->{sa
} = $self->{sa
};
605 $queue->{lic_valid
} = 1;
610 $msginfo->{testmode
} = $opt_testmode;
611 $msginfo->{sender
} = $smtp->{from
};
612 $msginfo->{xforward
} = $smtp->{xforward
};
613 $msginfo->{targets
} = $smtp->{to
};
615 $msginfo->{hostname
} = PVE
::INotify
::nodename
();
616 my $resolv = PVE
::INotify
::read_file
('resolvconf');
618 $msginfo->{domain
} = $resolv->{search
};
619 $msginfo->{fqdn
} = "$msginfo->{hostname}.$msginfo->{domain}";
620 $msginfo->{lcid
} = $lcid;
622 # $msginfo->{targets} is case sensitive,
623 # but pmail is always lower case!
625 foreach my $t (@{$msginfo->{targets
}}) {
627 if ($ldap && ($res = $ldap->account_info ($t))) {
628 $msginfo->{pmail
}->{$t} = $res->{pmail
};
630 $msginfo->{pmail
}->{$t} = lc ($t);
634 # PHASE 2 - parse mail
637 my $maxfiles = $pmg_cfg->get('clamav', 'archivemaxfiles');
639 my $entity = $queue->parse_mail($maxfiles);
641 $self->log (3, "$queue->{logid}: new mail message-id=%s", $queue->{msgid
});
643 # PHASE 3 - run external content analyzers
644 # (SPAM analyzer is run on demand later)
645 # on error: log error messages
648 # test for virus first
649 $queue->{vinfo
} = PMG
::Utils
::analyze_virus
(
650 $queue, $queue->{dataname
}, $pmg_cfg, $opt_testmode);
652 # always add this headers to incoming mails
653 # to enable user to report false negatives
654 if (!$msginfo->{trusted
}) {
655 if ($queue->{vinfo
}) {
656 $entity->head->replace('X-Proxmox-VInfo', $queue->{vinfo
});
660 # we unpack after virus scanning, because this is more secure.
661 # This way virus scanners gets the whole mail files and are able
662 # to detect phishing signature for example - which would not work
663 # if we decompose first and only analyze the decomposed attachments.
664 # Disadvantage is that we need to unpack more than
665 # once (bad performance).
667 # should we scan content types inside archives
669 my $rulecache = $self->{rulecache
};
671 my $scan_archives = 0;
673 if (($rulecache->{archivefilter_in
} && !$msginfo->{trusted
}) ||
674 ($rulecache->{archivefilter_out
} && $msginfo->{trusted
})) {
678 if ($scan_archives && !$queue->{vinfo
}) {
680 # unpack all archives - determine contained content types
682 my $decdir = $queue->{dumpdir
} . "/__decoded_archives";
685 my $start = [gettimeofday
];
690 # limits: We use clamav limit for maxfiles, and scan
691 # only 4 levels, timeout of 30 seconds
693 $unpack = PMG
::Unpack-
>new (
696 ctonly
=> 1, # only detect CTs
698 maxfiles
=> $maxfiles);
700 $self->unpack_entity ($unpack, $entity, $msginfo, $queue);
705 $unpack->cleanup() if $unpack;
707 my $elapsed = int(tv_interval
($start) * 1000);
710 $self->log (3, "$queue->{logid}: unpack archive failed ($elapsed ms) - $err");
714 # PHASE 4 - apply rules
715 # on error: exit (cleanup process should do the rest)
716 $msginfo->{maxspamsize
} = $pmg_cfg->get('spam', 'maxspamsize');
717 if ($msginfo->{maxspamsize
} <= 1024*64) {
718 $msginfo->{maxspamsize
} = 1024*64;
721 if ($msginfo->{trusted
}) {
722 my $hide = $pmg_cfg->get('mail', 'hide_received');
723 $entity->head->delete("Received") if $hide;
726 $matching_rules = $self->apply_rules($queue, $msginfo, $entity, $ldap);
731 $self->{errors
} = $queue->{errors
};
734 $self->{errors
} = 1 if $err;
740 my ($csec_end, $usec_end) = gettimeofday
();
742 int (($csec_end-$csec)*1000 + ($usec_end - $usec)/1000);
744 # PHASE 5 - log statistics
745 # on error: log error messages
748 my $dbh = $self->{ruledb
}->{dbh
};
750 foreach my $rid (@$matching_rules) {
751 $where .= $where ?
" OR ID = $rid" : "ID = $rid";
754 $dbh->do ("UPDATE Rule " .
755 "SET Count = Count + 1 " .
759 my $insert_cmds = "SELECT nextval ('cstatistic_id_seq');INSERT INTO CStatistic " .
760 "(CID, RID, ID, Time, Bytes, Direction, Spamlevel, VirusInfo, PTime, Sender) VALUES (" .
761 "$lcid, currval ('cstatistic_id_seq'), currval ('cstatistic_id_seq'),";
763 $insert_cmds .= $queue->{rtime
} . ',';
764 $insert_cmds .= $queue->{bytes
} . ',';
765 $insert_cmds .= $dbh->quote ($msginfo->{trusted
} ?
0 : 1) . ',';
766 $insert_cmds .= ($queue->{sa_score
} || 0) . ',';
767 $insert_cmds .= $dbh->quote ($queue->{vinfo
}) . ',';
768 $insert_cmds .= $time_total . ',';
769 $insert_cmds .= $dbh->quote ($msginfo->{sender
}) . ');';
771 foreach my $r (@{$msginfo->{targets
}}) {
772 my $tmp = $dbh->quote ($r);
773 my $blocked = $queue->{status
}->{$r} eq 'blocked' ?
1 : 0;
774 $insert_cmds .= "INSERT INTO CReceivers (CStatistic_CID, CStatistic_RID, Receiver, Blocked) " .
775 "VALUES ($lcid, currval ('cstatistic_id_seq'), $tmp, '$blocked'); ";
778 $dbh->do ($insert_cmds);
781 # save $err (because log clears $@)
784 $time_total = $time_total/1000;
786 my $ptspam = ($queue->{ptime_spam
} || 0)/1000;
787 my $ptclam = ($queue->{ptime_clam
} || 0)/1000;
789 $self->log (3, "$queue->{logid}: processing time: ${time_total} seconds ($ptspam, $ptclam)");
791 $msginfo->{test_fh
}->close if $opt_testmode;
797 sub process_request
{
799 my $prop = $self->{server
};
800 my $sock = $prop->{client
};
804 # make sure the ldap cache is up to date
805 $self->{ldap
}->update (1);
807 $self->load_config() if $self->{reload_config
};
809 $self->{trusted
} = 0;
810 if ($prop->{sockport
} == $opt_int_port && !$opt_untrusted) {
811 $self->{trusted
} = 1;
814 my $smtp = PMG
::SMTP-
>new ($sock);
816 my $maxcount = $max_requests - $prop->{requests
};
818 my $count = $smtp->loop (\
&handle_smtp
, $self, $maxcount);
820 $prop->{requests
} += $count - 1;
826 $self->log (0, $err) if $err;
828 kill (15, $prop->{ppid
}) if $opt_testmode;
830 my $mem = PVE
::ProcFSTools
::read_memory_usage
();
833 $self->log (0, "memory usage: $mem->{size} bytes");
835 if ($self->{errors
}) {
836 $self->log (0, "fast exit because of errors (free $mem->{size} bytes)");
838 } elsif ($mem->{size
} > (300*1024*1024)) {
839 $self->log (0, "fast exit to reduce server load (free $mem->{size} bytes)");
844 $self->done (1) if $err;
847 # test sig_hup with: for ((;;)) ;do kill -HUP `cat /var/run/${prog_name}.pid`; done;
848 # wrapper to avoid multiple calls to sig_hup
851 my $prop = $self->{server
};
853 return if defined ($prop->{_HUP
}); # do not call twice
855 $self->SUPER::sig_hup
();
858 sub restart_close_hook
{
861 my $sig_set = POSIX
::SigSet-
>new;
862 $sig_set->addset (&POSIX
::SIGHUP
);
863 $sig_set->addset (&POSIX
::SIGCHLD
); # to avoid zombies
864 my $old_sig_set = POSIX
::SigSet-
>new();
866 sigprocmask
(SIG_BLOCK
, $sig_set, $old_sig_set);
869 sub pre_server_close_hook
{
871 my $prop = $self->{server
};
873 if (defined $prop->{_HUP
}) {
874 undef $prop->{pid_file_unlink
};
877 if (defined $prop->{children
}) {
878 foreach my $pid (keys %{$prop->{children
}}) {
879 kill (1, $pid); # HUP childs
883 # nicely shutdown childs (give them max 30 seconds to shut down)
884 my $previous_alarm = alarm (30);
886 local $SIG{ALRM
} = sub { die "Timed Out!\n" };
889 1 while ((($pid = waitpid (-1, 0)) > 0) || ($! == EINTR
));
891 alarm ($previous_alarm);
894 # initialize mime system before fork
895 xdg_mime_get_mime_type_for_file
($0);
898 server
=> $server_attr,
901 if (!$opt_testmode) {
908 my $sender ='sender@proxtest.com';
909 my $targets = ['target1@proxtest.com',
910 'target2@proxtest.com',
911 'target3@proxtest.com'];
913 my $smtp = Net
::SMTP-
>new ('127.0.0.1', Port
=> 10023);
915 die "unable to connect $!" if !$smtp;
917 # syslog ('info', "connected to " . $smtp->domain);
919 $smtp->mail ($sender);
920 $smtp->to (@$targets);
924 open (TMP
, $opt_testmode) ||
925 die "unable to upen file '$opt_testmode' - $! :ERROR";
927 $smtp->datasend ($_);
931 $smtp->datasend ("\n");
944 pmg-smtp-filter - the Proxmox mail filter
948 pmg-smtp-filter [-u] [-t testfile]
952 Documentation is available at www.proxmox.com