For clients which receive their e-mail from a server with SMTP rather than POP3. This script can be executed from rc.local to pick up messages queued on the server.
#!/usr/bin/perl -w
# /usr/local/bin/etrn
# For clients which receive their e-mail from a server with SMTP rathe
+r
# than POP3. This script can be executed from rc.local to pick up mess
+ages
# queued on the server:
# /usr/local/bin/etrn gateway&
# Nigel Horne, njh@despammed.com, Wharfedale Computers Ltd. Barnsley
use strict;
use Net::SMTP;
die "Usage: $0 host\n" unless @ARGV;
my $host = shift(@ARGV);
my $smtp = Net::SMTP->new($host);
unless ($smtp) { die "$0: $host: $!\n" }
foreach my $alias (split(/ /, `/bin/hostname -a`)) {
unless ($alias =~ /(localhost|^\n$)/i) {
print "Receiving messages for $alias\n";
unless ($smtp->etrn($alias)) { warn "$0: $host: etrn failed fo
+r $alias\n" }
}
}
chop(my $alias = `/bin/hostname -s`);
print "Receiving messages for $alias\n";
unless ($smtp->etrn($alias)) { warn "$0: $host: etrn failed for $alias
+\n" }
$smtp->quit();