Quotecpan> install Net::SMTP::Server
Fetching with LWP:
http://cpan.strawberryperl.com/authors/01mailrc.tx...
Fetching with LWP:
http://cpan.strawberryperl.com/modules/02packages....
Fetching with LWP:
http://cpan.strawberryperl.com/modules/03modlist.d...
Database was generated on Thu, 28 Jan 2016 07:55:51 GMT
Updating database file ...
Done!
Running install for module 'Net::SMTP::Server'
Fetching with LWP:
http://cpan.strawberryperl.com/authors/id/M/MA/MAC...
Fetching with LWP:
http://cpan.strawberryperl.com/authors/id/M/MA/MAC...
Checksum for C:\strawberry\cpan\sources\authors\id\M\MA\MACGYVER\SMTP-Server-1.1.tar.gz ok
Scanning cache C:\strawberry\cpan\build for sizes
............................................................................DONE
No such file in archive: 'SMTP-Server-1.1/Server/macgyver@starbase.tos.net.29089:1' at C:\strawberry\perl\lib/CPAN/Tarzip.pm line 408.
Could not find file 'macgyver@starbase.tos.net.29089:1' in memory. at C:\strawberry\perl\lib/CPAN/Tarzip.pm line 408.
Making symbolic link 'C:\strawberry\cpan\build\tmp-1572\SMTP-Server-1.1\Server\.#Spam.pm' to 'macgyver@starbase.tos.net.29089:1' failed at C:\strawberry\perl\lib/CPAN/Tarzip.pm line 408.
Could not extract 'SMTP-Server-1.1/Server/.#Spam.pm' at C:\strawberry\perl\lib/CPAN/Tarzip.pm line 408.
Could not untar with Archive::Tar. MACGYVER/SMTP-Server-1.1.tar.gz
Had problems unarchiving. Please build manually
Stopping: 'install' failed for 'Net::SMTP::Server'.
Failed during this command:
MACGYVER/SMTP-Server-1.1.tar.gz : unwrapped NO -- untar failed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
#!/usr/bin/perl use strict; use warnings; use Data::Dumper; require Data::Dumper; Data::Dumper->import(qw(Dumper)); local $Data::Dumper::Purity; $Data::Dumper::Purity = 1; local $Data::Dumper::Useqq; $Data::Dumper::Useqq = 1; local $Data::Dumper::Sortkeys; $Data::Dumper::Sortkeys = sub { my ($hash) = @_; return [(sort {lc $a cmp lc $b} keys %$hash)]; }; use 5.010; require Net::SMTP::Server; require Net::SMTP::Server::Client; my $server = new Net::SMTP::Server('localhost',25); while(my $conn = $server->accept()) { my $client = new Net::SMTP::Server::Client($conn) or die("Unable to handle client connection: $!\n"); $client->process || next; say Dumper($client); say Dumper($conn); }
Quoted:\test>perl test_smtp_server.pl
defined(@array) is deprecated at C:/strawberry/perl/site/lib/Net/SMTP/Server/Client.pm line 129.
(Maybe you should just omit the defined()?)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
#!/usr/bin/perl use strict; use warnings; use Data::Dumper; require Data::Dumper; Data::Dumper->import(qw(Dumper)); local $Data::Dumper::Purity; $Data::Dumper::Purity = 1; local $Data::Dumper::Useqq; $Data::Dumper::Useqq = 1; local $Data::Dumper::Sortkeys; $Data::Dumper::Sortkeys = sub { my ($hash) = @_; return [(sort {lc $a cmp lc $b} keys %$hash)]; }; use 5.010; require Net::SMTP::Server; require Net::SMTP::Server::Client; my $server = new Net::SMTP::Server('localhost',25); while(my $conn = $server->accept()) { my $client = new Net::SMTP::Server::Client($conn) or die("Unable to handle client connection: $!\n"); $client->process || next; say Dumper($client); say Dumper($conn); }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
#!/usr/bin/perl use strict; use warnings; use lib 'T:\\'; # eigeneModule use 5.010; use Data::Dumper ( qw(Dumper) ); local $Data::Dumper::Purity = 1; local $Data::Dumper::Useqq = 1; local $Data::Dumper::Sortkeys = sub {my ($hash) = @_; return [(sort {lc $a cmp lc $b} keys %$hash)]; }; use Net::SMTP::Server; use Net::SMTP::Server::Client; my $server = new Net::SMTP::Server('127.0.0.1',25); while(my $conn = $server->accept()) { my $client = new Net::SMTP::Server::Client($conn) or die "Unable to handle client connection: $!\n"; $client->process; say Dumper($client); }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
#!/usr/bin/perl use strict; use warnings; use 5.010; use Data::Dumper (qw(Dumper)); local $Data::Dumper::Purity = 1; local $Data::Dumper::Useqq = 1; local $Data::Dumper::Sortkeys = sub { my ($hash) = @_; return [ ( sort { lc $a cmp lc $b } keys %$hash ) ]; }; use lib '.'; use Net::SMTP::Server; use Net::SMTP::Server::Client; $Net::SMTP::Server::Client::DEBUG = 1; my $server = new Net::SMTP::Server( '127.0.0.1', 25 ); while ( my $conn = $server->accept() ) { my $client = new Net::SMTP::Server::Client($conn) or die "Unable to handle client connection: $!\n"; $client->process; say Dumper($client); }
test@127.0.0.1 test
2016-03-18T09:59:48 GwenDragonIch habe es erweitert. Damit du und Andere sehen wie sowas geht.
2016-03-18T09:59:48 GwenDragonWarum nimmst du nicht hMailserver?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
my $PID;
BEGIN {
$PID = getpid();
}
SIG{TERM} = sub __set_semaphor {
open my $sema, '>', "$PID.semaphor";
print $sema 1;
close $sema;
return 1;
};
# bei Terminierung hier Aufräumen, später Dateien etc schließen, was weiß ich was du noch machst...
sub __cleanup {
my $self = shift;
sleep(10);
unlink "$PID.semaphor";
1;
}
sub process {
my $self = shift;
my($cmd, @args);
my $sock = $self->{SOCK};
while(my $line = <$sock>) {
# check for termination semaphore
if ( open my $sema, '<', "$PID.semaphor") {
my $terminated = <$sema>;
if ($terminated =~ /^1/) {
$self->_put("451 4.7.1 Service unavailable - try again later;");
$self->__cleanup();
exit(255); # end client
}
}
$Net::SMTP::Server::Client::DEBUG and print STDOUT $line;
# Clean up.
chomp $line;
$line =~ s/^\s+//;
$line =~ s/\s+$//;
if (!length $line) {
$self->_put("500 Learn to type!");
next;
}
($cmd, @args) = split(/\s+/,$line);
$cmd =~ tr/a-z/A-Z/;
if( !defined $_cmds{$cmd} ) {
$self->_put("500 Learn to type!");
next;
}
return(defined($self->{MSG}) ? 1 : 0) unless
&{$_cmds{$cmd}}($self, \@args);
}
return undef;
}
Quotesmtp_server_comm=HASH(0x27feb98)220 MacGyver SMTP Ready.
EHLO meinpc
smtp_server_comm=HASH(0x27feb98)250 SERVER MacGyver SMTP
smtp_server_comm=HASH(0x27feb98)250-SERVER
smtp_server_comm=HASH(0x27feb98)250-AUTH PLAIN LOGIN
AUTH CRAM-MD5
smtp_server_comm=HASH(0x27feb98)504 Authentication mechanism not supported.
AUTH LOGIN
smtp_server_comm=HASH(0x27feb98)334 VXNlcm5hbWU6
smtp_server_comm=HASH(0x27feb98)334 UGFzc3dvcmQ6
bWtGMjAxNiM=
smtp_server_comm=HASH(0x27feb98)235 2.7.0 Authentication successful
MAIL FROM:<absender@test.de>
smtp_server_comm=HASH(0x27feb98)250 Ok...got it.
RCPT TO:<test@test.de>
smtp_server_comm=HASH(0x27feb98)250 Ok...got it.
RSET
smtp_server_comm=HASH(0x27feb98)250 Fine fine.
RSET
smtp_server_comm=HASH(0x27feb98)250 Fine fine.
MAIL FROM:<absender@test.de>
smtp_server_comm=HASH(0x27feb98)250 Ok...got it.
RCPT TO:<test@test.de>
smtp_server_comm=HASH(0x27feb98)250 Ok...got it.
DATA
smtp_server_comm=HASH(0x27feb98)354 Give it to me, big daddy.
smtp_server_comm=HASH(0x27feb98)250 I got it darlin'.
QUIT
smtp_server_comm=HASH(0x27feb98)221 Good.
Quotesmtp_server_comm=HASH(0x2a30b88)220 MacGyver SMTP Ready.
EHLO fritzbox
smtp_server_comm=HASH(0x2a30b88)250 SERVER MacGyver SMTP
smtp_server_comm=HASH(0x2a30b88)250-SERVER
smtp_server_comm=HASH(0x2a30b88)250-AUTH LOGIN PLAIN
QUIT
smtp_server_comm=HASH(0x2a30b88)221 Good.
1 2 3 4 5 6 7 8 9
my %_auths = ( PLAIN => \&_auth_plain, LOGIN => \&_auth_login, ); # preferred order of login methods my @_auths = ( LOGIN, PLAIN, );
1 2 3 4 5 6 7 8
sub _ehlo { my $self = shift; my $host = Sys::Hostname::hostname; $self->_put("250 $host MacGyver SMTP"); $self->_put("250-$host"); $self->_put("250-AUTH " . join(" ",@_auths) ); }
QuoteE-Mail-Zustellung gescheitert: TCP-Fehler. [3 Meldungen seit 19.04.16 11:41:44]
QuoteAug 06, 1999
Module version: 1.0
QuoteFailed during this command:
MACGYVER/SMTP-Server-1.1.tar.gz : unwrapped NO -- untar failed
QuoteS: 220 MacGyver SMTP Ready.
C: EHLO SERVER
S: 250-SERVER Hello SERVER
S: 250 AUTH LOGIN PLAIN
C: QUIT
S: 221 Good.