xref: /openbsd-src/gnu/usr.bin/perl/cpan/libnet/t/smtp.t (revision eac174f2741a08d8deb8aae59a7f778ef9b5d770)
1b8851fccSafresh1#!perl
2b8851fccSafresh1
3b8851fccSafresh1use 5.008001;
4b8851fccSafresh1
5b8851fccSafresh1use strict;
6b8851fccSafresh1use warnings;
7b39c5158Smillert
8b39c5158SmillertBEGIN {
9b8851fccSafresh1    if (!eval { require Socket }) {
10*eac174f2Safresh1        print "1..0 # Skip: no Socket\n"; exit 0;
11b39c5158Smillert    }
12*eac174f2Safresh1    if (ord('A') == 193 && !eval { require Convert::EBCDIC }) {
13*eac174f2Safresh1        print "1..0 # Skip: EBCDIC but no Convert::EBCDIC\n"; exit 0;
14b39c5158Smillert    }
15b39c5158Smillert}
16b39c5158Smillert
17b39c5158Smillertuse Net::Config;
18b39c5158Smillertuse Net::SMTP;
19b39c5158Smillert
20*eac174f2Safresh1unless(@{$NetConfig{smtp_hosts}}) {
21*eac174f2Safresh1    print "1..0 # Skip: no smtp_hosts defined in config\n";
22*eac174f2Safresh1    exit 0;
23*eac174f2Safresh1}
24*eac174f2Safresh1
25*eac174f2Safresh1unless($NetConfig{test_hosts}) {
26*eac174f2Safresh1    print "1..0 # Skip: test_hosts not enabled in config\n";
27b39c5158Smillert    exit 0;
28b39c5158Smillert}
29b39c5158Smillert
30b39c5158Smillertprint "1..3\n";
31b39c5158Smillert
32b39c5158Smillertmy $i = 1;
33b39c5158Smillert
34b8851fccSafresh1my $smtp = Net::SMTP->new(Debug => 0)
35b39c5158Smillert        or (print("not ok 1\n"), exit);
36b39c5158Smillert
37b39c5158Smillertprint "ok 1\n";
38b39c5158Smillert
39b39c5158Smillert$smtp->domain or print "not ";
40b39c5158Smillertprint "ok 2\n";
41b39c5158Smillert
42b39c5158Smillert$smtp->quit or print "not ";
43b39c5158Smillertprint "ok 3\n";
44b39c5158Smillert
45