Thread Net::SMTP::Server auf Windows 7 (70 answers)
Opened by bianca at 2016-02-29 15:58

bianca
 2016-03-04 17:28
#184037 #184037
User since
2009-09-13
6977 Artikel
BenutzerIn

user image
Da ist die nächste Frage schon :)

Das Testscript:
Code (perl): (dl )
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);
}

Server startet auch:
Quote
d:\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()?)

Wenn ich dann aber mit Outlook dem SMTP teste meldet dieser sich zwar (siehe Attachment 1) aber in der Eingabeaufforderung mit Perl ändert sich nichts. Ich würde erwarten, dort die Ausgaben von Dumper($client) und Dumper($conn) zu sehen. Aber wahrscheinlich habe ich den Mechanismus noch nicht begriffen. Die Doku auf CPAN:Net::SMTP::Server ist für mich auch etwas zu knapp.
An welcher Stelle muss ich Code platzieren der ausgeführt wird, wenn eine E-Mail eingeliefert wird und wie komme ich an die Daten der E-Mail?
Danke
Anhänge
image/png
537 x 280
smtp_server1.png
smtp_server1.png
10 print "Hallo"
20 goto 10

View full thread Net::SMTP::Server auf Windows 7