Hallo!
Ich möchte einen AntiViren-POP3/SMTP-Gateway testen, ob er so reagiert, wie ich mir das vorstelle.
=cut
#!/usr/bin/perl
########################################################################
Mailgateways testen...
my $mailgateway = '...';
my $to =
my $subj =
my $from =
########################################################################
use strict;
use Net::SMTP;
use MIME::Base64;
my $eicar_com = 'X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*';
my $eicar_att = encode_base64 $eicar_com;
mail($mailgateway, $to, $subj, "Teste $mailgateway als Virenscanner\n ", $from);
########################################################################
SMTP_Mail senden
sub mail{
# need 5 or 6 arguments
my ($smtp_host, $rcpt, $subject, $msg, $abs_email, $abs_name) = @_;
my $from = ();
if($abs_name){ $from = "$abs_name <$abs_email>" }
else{ $from = $abs_email}
# Neues Objekt erstellen
my $s = new Net::SMTP($smtp_host) or error("Keine Verbindung zu SMTP Host *$smtp_host*");
# format the message
my $message = <<"--MSG",
From: $abs_email
To: $rcpt
Subject: $subject
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="roro"
This is a multi-part message in MIME format.
--roro
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
$msg
--roro
Content-Type: application/octet-stream;
name="eicar.com"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="eicar.com"
$eicar_att
--roro--
--MSG
# Ab geht die Post
$s->mail($rcpt);
$s->to( $rcpt );
$s->data( $message );
$s->quit();
return 1;
}
=cut
Erwin
SELFforum - Das Tor zur Welt!
Theoretiker: Wie kommt das Kupfer in die Leitung?
Praktiker: Wie kommt der Strom in die Leitung?