| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package App::OpenMbox::Test; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 1 |  |  | 1 |  | 69982 | use 5.006; | 
|  | 1 |  |  |  |  | 4 |  | 
| 4 | 1 |  |  | 1 |  | 6 | use strict; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 35 |  | 
| 5 | 1 |  |  | 1 |  | 6 | use warnings; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 25 |  | 
| 6 | 1 |  |  | 1 |  | 527 | use POSIX; | 
|  | 1 |  |  |  |  | 6619 |  | 
|  | 1 |  |  |  |  | 5 |  | 
| 7 | 1 |  |  | 1 |  | 3432 | use App::OpenMbox::Client; | 
|  | 1 |  |  |  |  | 39153 |  | 
|  | 1 |  |  |  |  | 248 |  | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  | =head1 NAME | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | App::OpenMbox::Test - Auto delivery test for OpenMbox.net | 
| 12 |  |  |  |  |  |  |  | 
| 13 |  |  |  |  |  |  | =head1 VERSION | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  | Version 0.13 | 
| 16 |  |  |  |  |  |  |  | 
| 17 |  |  |  |  |  |  | =cut | 
| 18 |  |  |  |  |  |  |  | 
| 19 |  |  |  |  |  |  | our $VERSION = '0.13'; | 
| 20 |  |  |  |  |  |  |  | 
| 21 |  |  |  |  |  |  |  | 
| 22 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 23 |  |  |  |  |  |  |  | 
| 24 |  |  |  |  |  |  | This module sends test email to those big providers for checking delivery capacity. | 
| 25 |  |  |  |  |  |  |  | 
| 26 |  |  |  |  |  |  | use App::OpenMbox::Test; | 
| 27 |  |  |  |  |  |  |  | 
| 28 |  |  |  |  |  |  | # test openmbox | 
| 29 |  |  |  |  |  |  | my $test = App::OpenMbox::Test->new('user@openmbox.net','some.pass'); | 
| 30 |  |  |  |  |  |  | $test->deliver; | 
| 31 |  |  |  |  |  |  |  | 
| 32 |  |  |  |  |  |  | # or test pobox | 
| 33 |  |  |  |  |  |  | my $test = App::OpenMbox::Test->new('user@pobox.com','some.pass'); | 
| 34 |  |  |  |  |  |  | $test->deliver(host=>'smtp.pobox.com', | 
| 35 |  |  |  |  |  |  | port=>465, | 
| 36 |  |  |  |  |  |  | ssl=>1, | 
| 37 |  |  |  |  |  |  | debug=>1, | 
| 38 |  |  |  |  |  |  | ); | 
| 39 |  |  |  |  |  |  |  | 
| 40 |  |  |  |  |  |  |  | 
| 41 |  |  |  |  |  |  | =head1 SUBROUTINES/METHODS | 
| 42 |  |  |  |  |  |  |  | 
| 43 |  |  |  |  |  |  | =head2 new | 
| 44 |  |  |  |  |  |  |  | 
| 45 |  |  |  |  |  |  | New the instance by providing username and password. In fact you can send test mails with any smtp servers like gmail's. | 
| 46 |  |  |  |  |  |  |  | 
| 47 |  |  |  |  |  |  | See App::OpenMbox::Client for more details. | 
| 48 |  |  |  |  |  |  |  | 
| 49 |  |  |  |  |  |  | =cut | 
| 50 |  |  |  |  |  |  |  | 
| 51 |  |  |  |  |  |  | sub new { | 
| 52 | 0 |  |  | 0 | 1 |  | my $class = shift; | 
| 53 | 0 |  |  |  |  |  | my $user = shift; | 
| 54 | 0 |  |  |  |  |  | my $pass = shift; | 
| 55 |  |  |  |  |  |  |  | 
| 56 | 0 |  |  |  |  |  | bless {user=>$user, pass=>$pass}, $class; | 
| 57 |  |  |  |  |  |  | } | 
| 58 |  |  |  |  |  |  |  | 
| 59 |  |  |  |  |  |  | =head2 deliver | 
| 60 |  |  |  |  |  |  |  | 
| 61 |  |  |  |  |  |  | It will send mails to the following providers, see __DATA__ section. | 
| 62 |  |  |  |  |  |  |  | 
| 63 |  |  |  |  |  |  | - Gmail | 
| 64 |  |  |  |  |  |  | - Yahoo/AOL | 
| 65 |  |  |  |  |  |  | - Outlook/Hotmail | 
| 66 |  |  |  |  |  |  | - ProtonMail | 
| 67 |  |  |  |  |  |  | - GMX/Web.de | 
| 68 |  |  |  |  |  |  | - Vodafone | 
| 69 |  |  |  |  |  |  | - T-online | 
| 70 |  |  |  |  |  |  | - Freenet.de | 
| 71 |  |  |  |  |  |  | - Yandex | 
| 72 |  |  |  |  |  |  | - Mail.ru | 
| 73 |  |  |  |  |  |  |  | 
| 74 |  |  |  |  |  |  | Please note OpenMbox has the rate limit of 10 messages per minute, so you can't send too much at once. | 
| 75 |  |  |  |  |  |  |  | 
| 76 |  |  |  |  |  |  | After delivery you can check provider's inbox for new message. If it didn't reach, check Postfix's mail.log for details. | 
| 77 |  |  |  |  |  |  |  | 
| 78 |  |  |  |  |  |  | =cut | 
| 79 |  |  |  |  |  |  |  | 
| 80 |  |  |  |  |  |  | sub deliver { | 
| 81 | 0 |  |  | 0 | 1 |  | my $self = shift; | 
| 82 | 0 |  |  |  |  |  | my %args = @_; | 
| 83 |  |  |  |  |  |  |  | 
| 84 | 0 |  |  |  |  |  | my @rec; | 
| 85 |  |  |  |  |  |  |  | 
| 86 | 0 |  |  |  |  |  | while() { | 
| 87 | 0 | 0 |  |  |  |  | next if /^$/; | 
| 88 | 0 |  |  |  |  |  | chomp; | 
| 89 | 0 |  |  |  |  |  | push @rec,$_; | 
| 90 |  |  |  |  |  |  | } | 
| 91 |  |  |  |  |  |  |  | 
| 92 | 0 |  |  |  |  |  | my $recepients = join ',',@rec; | 
| 93 | 0 |  |  |  |  |  | my $time = strftime("%D %T",localtime); | 
| 94 |  |  |  |  |  |  |  | 
| 95 | 0 |  |  |  |  |  | my $client = App::OpenMbox::Client->new($self->{user},$self->{pass}); | 
| 96 |  |  |  |  |  |  | $client->sendmail(recepients => $recepients, | 
| 97 |  |  |  |  |  |  | type => 'text/plain', | 
| 98 |  |  |  |  |  |  | subject => 'Auto delivery test', | 
| 99 |  |  |  |  |  |  | body => "This is just a test message, sent by App::OpenMbox::Test on $time", | 
| 100 |  |  |  |  |  |  | host => $args{host}, | 
| 101 |  |  |  |  |  |  | port => $args{port}, | 
| 102 |  |  |  |  |  |  | ssl => $args{ssl}, | 
| 103 |  |  |  |  |  |  | debug => $args{debug}, | 
| 104 | 0 |  |  |  |  |  | ); | 
| 105 |  |  |  |  |  |  | } | 
| 106 |  |  |  |  |  |  |  | 
| 107 |  |  |  |  |  |  |  | 
| 108 |  |  |  |  |  |  | =head1 AUTHOR | 
| 109 |  |  |  |  |  |  |  | 
| 110 |  |  |  |  |  |  | Henry R, C<<  >> | 
| 111 |  |  |  |  |  |  |  | 
| 112 |  |  |  |  |  |  | =head1 BUGS | 
| 113 |  |  |  |  |  |  |  | 
| 114 |  |  |  |  |  |  | Please report any bugs or feature requests to C, or through | 
| 115 |  |  |  |  |  |  | the web interface at L.  I will be notified, and then you'll | 
| 116 |  |  |  |  |  |  | automatically be notified of progress on your bug as I make changes. | 
| 117 |  |  |  |  |  |  |  | 
| 118 |  |  |  |  |  |  |  | 
| 119 |  |  |  |  |  |  |  | 
| 120 |  |  |  |  |  |  |  | 
| 121 |  |  |  |  |  |  | =head1 SUPPORT | 
| 122 |  |  |  |  |  |  |  | 
| 123 |  |  |  |  |  |  | You can find documentation for this module with the perldoc command. | 
| 124 |  |  |  |  |  |  |  | 
| 125 |  |  |  |  |  |  | perldoc App::OpenMbox::Test | 
| 126 |  |  |  |  |  |  |  | 
| 127 |  |  |  |  |  |  |  | 
| 128 |  |  |  |  |  |  | You can also look for information at: | 
| 129 |  |  |  |  |  |  |  | 
| 130 |  |  |  |  |  |  | =over 4 | 
| 131 |  |  |  |  |  |  |  | 
| 132 |  |  |  |  |  |  | =item * RT: CPAN's request tracker (report bugs here) | 
| 133 |  |  |  |  |  |  |  | 
| 134 |  |  |  |  |  |  | L | 
| 135 |  |  |  |  |  |  |  | 
| 136 |  |  |  |  |  |  | =item * CPAN Ratings | 
| 137 |  |  |  |  |  |  |  | 
| 138 |  |  |  |  |  |  | L | 
| 139 |  |  |  |  |  |  |  | 
| 140 |  |  |  |  |  |  | =item * Search CPAN | 
| 141 |  |  |  |  |  |  |  | 
| 142 |  |  |  |  |  |  | L | 
| 143 |  |  |  |  |  |  |  | 
| 144 |  |  |  |  |  |  | =back | 
| 145 |  |  |  |  |  |  |  | 
| 146 |  |  |  |  |  |  |  | 
| 147 |  |  |  |  |  |  | =head1 ACKNOWLEDGEMENTS | 
| 148 |  |  |  |  |  |  |  | 
| 149 |  |  |  |  |  |  |  | 
| 150 |  |  |  |  |  |  | =head1 LICENSE AND COPYRIGHT | 
| 151 |  |  |  |  |  |  |  | 
| 152 |  |  |  |  |  |  | This software is Copyright (c) 2022 by Henry R. | 
| 153 |  |  |  |  |  |  |  | 
| 154 |  |  |  |  |  |  | This is free software, licensed under: | 
| 155 |  |  |  |  |  |  |  | 
| 156 |  |  |  |  |  |  | The Artistic License 2.0 (GPL Compatible) | 
| 157 |  |  |  |  |  |  |  | 
| 158 |  |  |  |  |  |  |  | 
| 159 |  |  |  |  |  |  | =cut | 
| 160 |  |  |  |  |  |  |  | 
| 161 |  |  |  |  |  |  | 1; # End of App::OpenMbox::Test | 
| 162 |  |  |  |  |  |  |  | 
| 163 |  |  |  |  |  |  |  | 
| 164 |  |  |  |  |  |  | __DATA__ |