Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Aug 1996 15:17:23 -0500 (CDT)
From:      Tony Kimball <alk@think.com>
To:        sckhoo@asiapac.net
Cc:        alk@think.com, xiyuan@npc.haplink.co.cn, freebsd-isp@freebsd.org
Subject:   Re: mail storage 
Message-ID:  <199608262017.PAA11717@compound.Think.COM>
References:  <199608250325.LAA05771@gandalf.asiapac.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Quoth Swee-Chuan Khoo on Sun, 25 August:
: 
: >>Why not just write a tiny little inetd service to run
: >>sendmail -q when you get a packet from their server?
: 
: okay, regarding the perl hack, i need some help on this.

Here, make it *really* easy, add this to /etc/aliases and run newaliases:  

sendmail: "| /usr/local/bin/sendmail -q"

then when the client goes online they use a command-line mail agent
to send an empty message to sendmail@your.server.  Here's one in perl
-- just change the #! for NT and the "localhost" for the client addr.

#!/usr/bin/perl
($name,$aliases,$proto) = getprotobyname('tcp');
($name,$aliases,$type,$len,$thataddr) = gethostbyname('localhost');
socket(S, 2, 1, $proto) || die $!;
connect(S,pack('S n a4 x8', 2, 25, $thataddr)) || die "connect: $!";
select(S); $| = 1; select(STDOUT);
chop($date = `date`);
chop($hostname = `hostname`);
print S "helo $hostname\n" || die $!;
print S "mail from: smagent@$hostname\n" || die $!;
print S "rcpt to: alk\n" || die $!;
print S "data\nRequest spool at $date\n.\n" || $!;
print S "quit\n" || die $!;
close(S) || die $!;
print "done\n";
exit(0);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199608262017.PAA11717>