[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: fake smtp setup?



On Thu, 2003-05-22 at 08:02, Ray wrote:
> is there a way to setup a fake smtp server so that any mail sent to it is 
> accepted and dropped?

--- snip ---
#! /usr/bin/perl

package FakeSMTP;
use strict;
use Net::SMTP::Server::Client;
use Net::Server::Fork;

our @ISA = qw(Net::Server::Fork);

sub process_request {
  my $self = shift;
  my $client = Net::SMTP::Server::Client->new($self->{server}->{client});
  $client->process;
  $self->log(0, sprintf("Accepted message from %s to %s",
			$client->{FROM}, join(", ", @{$client->{TO}})));
}

FakeSMTP->run(port => 25);

--- snip ---

-- 
Dave Carrigan
Seattle, WA, USA
dave@rudedog.org | http://www.rudedog.org/ | ICQ:161669680
UNIX-Apache-Perl-Linux-Firewalls-LDAP-C-C++-DNS-PalmOS-PostgreSQL-MySQL



Reply to: