
| Current Path : /var/www/web-klick.de/dsh/50_dev2017/1300__perllib/DivBasicF/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/web-klick.de/dsh/50_dev2017/1300__perllib/DivBasicF/AutoMail.pm |
package DivBasicF::AutoMail;
use DivBasicF::DBComSimple;
use Net::POP3;
use MIME::Entity;
sub new {
my $class = shift;
my $self = { @_ };
bless($self,$class);
return($self);
}
#***************************************************************************
sub start {
my $self = shift;
my $obj = DivBasicF::DBComSimple->new($self->{'process_database'},
$self->{'process_port'},2,100);
my $pop3 = Net::POP3->new("post.strato.de");
my $queue; my $msgid; my $com; my $text; my $pars; my $message; my @ee;
my $time0 = 0;
while (0 == 0) {
my $queue = $obj->query(
"select msgid,mailfrom,mailto,mailsubject from " .
" conn,conn_store where conn.id = conn_store.id " .
" and mailto != ''");
while (@$queue) {
$msgid = shift(@$queue);
last if (!$msgid);
$com = DivBasicF::DBComSimple->new($self->{'process_database'},
$self->{'process_port'},2,100);
$com->connection($msgid->[0]);
$text = $com->get();
$pars = [ 'Type' => "multipart/mixed",
'From' => $msgid->[1],
'To' => $msgid->[2],
'Message-ID' => $msgid->[0],
'Subject' => $msgid->[3],
'Data' => [split(/\n/,$text->[0])]
];
# $message->sign(); --> $signature
$message = MIME::Entity->build(@$pars);
$message->send();
sleep 1;
}
if (time() - $time0 > 2) {
print "POP3 ...\n";
$time0 = time();
$pop3 = Net::POP3->new("post.strato.de");
if ($pop3->login("ud\@shortnote.de","widor123")) {
$nr = $pop3->list();
foreach $o (keys %$nr) {
$msg = $pop3->get($o);
$msg = join("",@$msg);
$com = DivBasicF::DBComSimple->new($self->{'process_database'},
$self->{'process_port'},2,100);
if ($msg =~ /In-Reply-To\: +___continued___(\S+)/i) {
$com->connection($1);
}
print "MM: $msg\n";
$com->msg(["parse_mail",$msg]);
$pop3->delete($o);
}
}
$pop3->quit();
sleep 1;
}
}
}
1;