1package Email::Sender; 2# ABSTRACT: a library for sending email 3$Email::Sender::VERSION = '1.300031'; 4use Moo::Role; 5requires 'send'; 6 7#pod =head1 SYNOPSIS 8#pod 9#pod my $message = Email::MIME->create( ... ); 10#pod # produce an Email::Abstract compatible message object, 11#pod # e.g. produced by Email::Simple, Email::MIME, Email::Stuff 12#pod 13#pod use Email::Sender::Simple qw(sendmail); 14#pod use Email::Sender::Transport::SMTP qw(); 15#pod use Try::Tiny; 16#pod 17#pod try { 18#pod sendmail( 19#pod $message, 20#pod { 21#pod from => $SMTP_ENVELOPE_FROM_ADDRESS, 22#pod transport => Email::Sender::Transport::SMTP->new({ 23#pod host => $SMTP_HOSTNAME, 24#pod port => $SMTP_PORT, 25#pod }) 26#pod } 27#pod ); 28#pod } catch { 29#pod warn "sending failed: $_"; 30#pod }; 31#pod 32#pod =head1 OVERVIEW 33#pod 34#pod Email::Sender replaces the old and sometimes problematic Email::Send library, 35#pod which did a decent job at handling very simple email sending tasks, but was not 36#pod suitable for serious use, for a variety of reasons. 37#pod 38#pod Most users will be able to use L<Email::Sender::Simple> to send mail. Users 39#pod with more specific needs should look at the available Email::Sender::Transport 40#pod classes. 41#pod 42#pod Documentation may be found in L<Email::Sender::Manual>, and new users should 43#pod start with L<Email::Sender::Manual::QuickStart>. 44#pod 45#pod =head1 IMPLEMENTING 46#pod 47#pod Email::Sender itself is a Moo role. Any class that implements Email::Sender 48#pod is required to provide a method called C<send>. This method should accept any 49#pod input that can be understood by L<Email::Abstract>, followed by a hashref 50#pod containing C<to> and C<from> arguments to be used as the envelope. The method 51#pod should return an L<Email::Sender::Success> object on success or throw an 52#pod L<Email::Sender::Failure> on failure. 53#pod 54#pod =cut 55 56no Moo::Role; 571; 58 59__END__ 60 61=pod 62 63=encoding UTF-8 64 65=head1 NAME 66 67Email::Sender - a library for sending email 68 69=head1 VERSION 70 71version 1.300031 72 73=head1 SYNOPSIS 74 75 my $message = Email::MIME->create( ... ); 76 # produce an Email::Abstract compatible message object, 77 # e.g. produced by Email::Simple, Email::MIME, Email::Stuff 78 79 use Email::Sender::Simple qw(sendmail); 80 use Email::Sender::Transport::SMTP qw(); 81 use Try::Tiny; 82 83 try { 84 sendmail( 85 $message, 86 { 87 from => $SMTP_ENVELOPE_FROM_ADDRESS, 88 transport => Email::Sender::Transport::SMTP->new({ 89 host => $SMTP_HOSTNAME, 90 port => $SMTP_PORT, 91 }) 92 } 93 ); 94 } catch { 95 warn "sending failed: $_"; 96 }; 97 98=head1 OVERVIEW 99 100Email::Sender replaces the old and sometimes problematic Email::Send library, 101which did a decent job at handling very simple email sending tasks, but was not 102suitable for serious use, for a variety of reasons. 103 104Most users will be able to use L<Email::Sender::Simple> to send mail. Users 105with more specific needs should look at the available Email::Sender::Transport 106classes. 107 108Documentation may be found in L<Email::Sender::Manual>, and new users should 109start with L<Email::Sender::Manual::QuickStart>. 110 111=head1 IMPLEMENTING 112 113Email::Sender itself is a Moo role. Any class that implements Email::Sender 114is required to provide a method called C<send>. This method should accept any 115input that can be understood by L<Email::Abstract>, followed by a hashref 116containing C<to> and C<from> arguments to be used as the envelope. The method 117should return an L<Email::Sender::Success> object on success or throw an 118L<Email::Sender::Failure> on failure. 119 120=head1 AUTHOR 121 122Ricardo Signes <rjbs@cpan.org> 123 124=head1 CONTRIBUTORS 125 126=for stopwords Alex Efros Aristotle Pagaltzis Christian Walde David Golden Steinbrunner Hans Dieter Pearcey HIROSE Masaaki Justin Hunter Karen Etheridge Kenichi Ishigaki kga Kris Matthews William Blunn 127 128=over 4 129 130=item * 131 132Alex Efros <powerman@powerman.name> 133 134=item * 135 136Aristotle Pagaltzis <pagaltzis@gmx.de> 137 138=item * 139 140Christian Walde <walde.christian@googlemail.com> 141 142=item * 143 144David Golden <dagolden@cpan.org> 145 146=item * 147 148David Steinbrunner <dsteinbrunner@pobox.com> 149 150=item * 151 152Hans Dieter Pearcey <hdp@cpan.org> 153 154=item * 155 156HIROSE Masaaki <hirose31@gmail.com> 157 158=item * 159 160Justin Hunter <justin.d.hunter@gmail.com> 161 162=item * 163 164Karen Etheridge <ether@cpan.org> 165 166=item * 167 168Kenichi Ishigaki <ishigaki@cpan.org> 169 170=item * 171 172kga <watrty@gmail.com> 173 174=item * 175 176Kris Matthews <kris@tigerlms.com> 177 178=item * 179 180William Blunn <zgpmax@cpan.org> 181 182=back 183 184=head1 COPYRIGHT AND LICENSE 185 186This software is copyright (c) 2017 by Ricardo Signes. 187 188This is free software; you can redistribute it and/or modify it under 189the same terms as the Perl 5 programming language system itself. 190 191=cut 192