| 1 | package Email::Sender 2.603; | ||
| 2 | # ABSTRACT: a library for sending email | ||
| 3 | |||
| 4 | 13 | ▶ | use Moo::Role; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 13 | requires '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 | |||
| 56 | 13 | ▶ | no Moo::Role; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 57 | 13 | 1; | |
| 58 | |||
| 59 | __END__ | ||