Skip to content

Commit

Permalink
Added the broken smtp server I used for testing
Browse files Browse the repository at this point in the history
This is for when we get EPIPE when somewhere we are mailing
to disconnects early. It could be useful for testing broken
states in smtp_client.pl too.
  • Loading branch information
baudehlo committed Jun 7, 2012
1 parent e8bf1ac commit dc6573a
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions contrib/bad_smtp_server.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/perl

use warnings;
use strict;

use IO::Socket;

my $server = IO::Socket::INET->new(Listen => 5, LocalPort => 2525, Proto => "tcp");
$server || die $!;

while (my $client = $server->accept()) {
print "Got connection\n";
$client->print("220 hostname\r\n");
my $helo = <$client>;
$client->print("250 hi\r\n");
my $mail = <$client>;
$client->print("250 ok\r\n");
my $rcpt = <$client>;
$client->print("250 ok\r\n");
my $data = <$client>;
$client->print("354 ok\r\n");
my $line = <$client>;
$client->close();
print "Closed client\n";
}

0 comments on commit dc6573a

Please sign in to comment.