#======================================================== # MyMailServer #======================================================== package MyMailServer; #use Net::POP3; #@ISA = qw(Net::POP3); use strict; use Socket; use Net::Cmd; use IO::Socket::IP; use IO::Socket::INET; use IO::Socket::SSL; use Net::POP3; #use Net::POP3::SSLWrapper; use Mail::Header; use Jcode; #============================================================ # 変数等取得関数 #============================================================ #============================================================ # 静的関数 #============================================================ #============================================================ # コンストラクタ、デストラクタ #============================================================ BEGIN { } sub new { my ($module, $host, %hash) = @_; my $HostName = $host; #if(0) { # if($host !~ /^\d{1-4}\.\d{1-4}\.\d{1-4}\.\d{1-4}\$/) { # $HostName = $host; # my $packed_addr = gethostbyname($host); # if(!defined $packed_addr) { # print "Can not resolve host name [$host]: $!\n"; # return undef; # } ##print "packed_addr: $packed_addr\n"; # $host = inet_ntoa($packed_addr); ##print "host: $host\n"; # } #} my $this = {}; bless $this; #Utils::InitHTML(); #print("hash: $host: ", join(',', %hash), "
\n"); $this->{pPOP3} = Net::POP3->new($host, %hash); #my $pop = Net::POP3->new($host, SSL => 1, Port => 995, Timeout => 60, Debug => 1); #$this->{pPOP3} = $pop; if(!defined $this->{pPOP3}) { print "Can't connect to [$host]: $!\n"; return undef; } #print "this=$this\n"; #print "this= [$this]\n"; $this->{HostName} = $HostName; $this->{HostIPAddress} = $host; foreach my $key (keys %hash) { $this->{$key} = $hash{$key}; } return $this; } sub DESTROY { my $this = shift; } #============================================================ # 一般関数 #============================================================ sub login { my ($this, $user, $password, %hash) = @_; return $this->{pPOP3}->login($user, $password, %hash); } sub apop { my ($this, $user, $password, %hash) = @_; return $this->{pPOP3}->apop($user, $password, %hash); } sub quit { my ($this, @a) = @_; return $this->{pPOP3}->quit(@a); } sub top { my ($this, $msgnum, @a) = @_; return $this->{pPOP3}->top($msgnum, @a); } sub last { my ($this, @a) = @_; return $this->{pPOP3}->last(@a); } sub get { my ($this, $msgnum, @a) = @_; return $this->{pPOP3}->get($msgnum, @a); } sub getfh { my ($this, $msgnum, @a) = @_; return $this->{pPOP3}->getfh($msgnum, @a); } sub message { my ($this, @a) = @_; return $this->{pPOP3}->message(@a); } sub uidl { my ($this, $msgnum, @a) = @_; return $this->{pPOP3}->uidl($msgnum, @a); } sub popstat { my ($this, @a) = @_; return $this->{pPOP3}->popstat(@a); } sub list { my ($this, $msgnum, @a) = @_; return $this->{pPOP3}->list($msgnum, @a); } sub reset { my ($this, @a) = @_; return $this->{pPOP3}->reset(@a); } sub delete { my ($this, $msgnum, @a) = @_; return $this->{pPOP3}->delete($msgnum, @a); } 1;