File: live.t

package info (click to toggle)
libnet-smtp-tls-butmaintained-perl 0.24-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, forky, sid, trixie
  • size: 176 kB
  • sloc: perl: 375; makefile: 2
file content (43 lines) | stat: -rw-r--r-- 879 bytes parent folder | download | duplicates (3)
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/perl

use strict;
use warnings;
use FindBin qw/$Bin/;
use Test::More;
use vars qw/%config/;

BEGIN {
    unless ( $ENV{TEST_TLS} ) {
        plan skip_all => 'set $ENV{TEST_TLS} to test';
    }
    open( my $fh, '<', "$Bin/config.txt" ) or do {
        plan skip_all => "Can't find $Bin/config.txt";
    };
    while ( my $line = <$fh> ) {
        chomp($line);
        my ( $k, $v ) = split( /\s*\=\s*/, $line );
        $config{$k} = $v;
    }
    close($fh);
    plan tests => 1;
}

use Net::SMTP::TLS::ButMaintained;

my $mailer = Net::SMTP::TLS::ButMaintained->new(
    $config{host},
    Port     => $config{port},
    User     => $config{user},
    Password => $config{pass},
    Debug    => 1,
);
$mailer->mail( $config{user} );
$mailer->to( $config{to} );
$mailer->data;
$mailer->datasend("Sent thru TLS!");
$mailer->dataend;
$mailer->quit;

ok($mailer);

1;