Thread Fehlerhandling mit MIME::Lite (12 answers)
Opened by bianca at 2010-03-31 18:30

topeg
 2010-03-31 19:02
#135539 #135539
User since
2006-07-10
2611 Artikel
BenutzerIn

user image
so könnte man es versuchen:
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
26
27
use MIME::Lite;
MIME::Lite -> quiet (1);

my $last=eval{
  MIME::Lite -> send (
        'smtp',
        $config{smtp_host},
        Timeout         => 60,
        AuthUser        => $config{smtp_user},
        AuthPass        => $config{smtp_pass},
  );

  my $msg = MIME::Lite -> new (
        Encoding        => 'quoted-printable',
        From            => "$config{from_name} <$config{from_mail}>",
        To              => "$config{empfaenger_name} <$config{empfaenger_mail}>",
        Subject         => $config{betreff},
        Type            => 'TEXT',
        Data            => $config{text},
  );
  my $str = $msg -> as_string;
  print "Mail wird verschickt...\n";
  $msg -> send or die "Mist\n";
  return 1 if $msg -> last_send_successful ();
}
if (defined $last && $last) { print "Letzte Sendung erfolgreich\n"; }
else { print "Sendung FEHLERHAFT! ($@)\n"; }

View full thread Fehlerhandling mit MIME::Lite