| 1 | package Eve::Email; | ||
| 2 | |||
| 3 | 10 | ▶ | use parent qw(Eve::Class); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 10 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 10 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 10 | ▶ | use Email::Sender::Simple qw(sendmail); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 10 | ▶ | use Email::Simple; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | 10 | ▶ | use Email::Simple::Creator; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | |||
| 12 | =head1 NAME | ||
| 13 | |||
| 14 | B<Eve::Email> - a wrapper for the C<Email::Sender::Simple> library. | ||
| 15 | |||
| 16 | =head1 SYNOPSIS | ||
| 17 | |||
| 18 | use Eve::Email; | ||
| 19 | |||
| 20 | my $mailer = Eve::Email->new(); | ||
| 21 | |||
| 22 | $mailer->send(to => $address, subject => $subject, body => $body); | ||
| 23 | |||
| 24 | =head2 Constructor arguments | ||
| 25 | |||
| 26 | =over 4 | ||
| 27 | |||
| 28 | =item C<from> | ||
| 29 | |||
| 30 | The from address line that will be added to each sent email. | ||
| 31 | |||
| 32 | =back | ||
| 33 | |||
| 34 | =head1 METHODS | ||
| 35 | |||
| 36 | =head2 B<init()> | ||
| 37 | |||
| 38 | =cut | ||
| 39 | |||
| 40 | 1 | ▶ | sub init { |
|
Subroutine
init: called CC=1 SCAR=0.0
Pod
documented
| |||
| 41 | 1 | my ($self, %arg_hash) = @_; | |
| 42 | 1 | Eve::Support::arguments(\%arg_hash, my ($from)); | |
| 43 | |||
| 44 | 1 | $self->{'_from'} = $from; | |
| 45 | |||
| 46 | 1 | return; | |
| 47 | } | ||
| 48 | |||
| 49 | =head2 B<send()> | ||
| 50 | |||
| 51 | Send an email body with a certain subject to a certain recipient. | ||
| 52 | |||
| 53 | =head3 Arguments | ||
| 54 | |||
| 55 | =over 4 | ||
| 56 | |||
| 57 | =item C<to> | ||
| 58 | |||
| 59 | =item C<subject> | ||
| 60 | |||
| 61 | =item C<body> | ||
| 62 | |||
| 63 | =back | ||
| 64 | |||
| 65 | =cut | ||
| 66 | |||
| 67 | 2 | ▶ | sub send { |
|
Subroutine
send: called CC=1 SCAR=0.0
Pod
documented
| |||
| 68 | 2 | my ($self, %arg_hash) = @_; | |
| 69 | 2 | Eve::Support::arguments(\%arg_hash, my ($to, $subject, $body)); | |
| 70 | |||
| 71 | 2 | my $email = Email::Simple->create( | |
| 72 | header => [ | ||
| 73 | To => $to, | ||
| 74 | From => $self->_from, | ||
| 75 | Subject => $subject, | ||
| 76 | ], | ||
| 77 | body => $body); | ||
| 78 | |||
| 79 | 2 | sendmail($email); | |
| 80 | } | ||
| 81 | |||
| 82 | =head1 LICENSE AND COPYRIGHT | ||
| 83 | |||
| 84 | Copyright 2012 Igor Zinovyev. | ||
| 85 | |||
| 86 | This program is free software; you can redistribute it and/or modify it | ||
| 87 | under the terms of either: the GNU General Public License as published | ||
| 88 | by the Free Software Foundation; or the Artistic License. | ||
| 89 | |||
| 90 | See http://dev.perl.org/licenses/ for more information. | ||
| 91 | |||
| 92 | |||
| 93 | =head1 AUTHOR | ||
| 94 | |||
| 95 | =over 4 | ||
| 96 | |||
| 97 | =item L<Igor Zinovyev|mailto:zinigor@gmail.com> | ||
| 98 | |||
| 99 | =back | ||
| 100 | |||
| 101 | =cut | ||
| 102 | |||
| 103 | 10 | 1; | |