Skip to content

Commit

Permalink
Merge pull request #23 from melmothx/feature/attach-data
Browse files Browse the repository at this point in the history
Do not skip attachment if Data is provided
  • Loading branch information
ironcamel committed Mar 18, 2015
2 parents aa55c51 + 010ceb5 commit ff12cdb
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions lib/Dancer/Plugin/Email.pm
Expand Up @@ -47,12 +47,14 @@ register email => sub {
my %mime;
if (ref($attachment) eq 'HASH') {
%mime = %$attachment;
unless ($mime{Path}) {
warning "No Path provided for this attachment!";
unless ($mime{Path} || $mime{Data}) {
warning "No Path or Data provided for this attachment!";
next;
};
$mime{Encoding} ||= 'base64';
$mime{Type} ||= File::Type->mime_type($mime{Path}),
if ($mime{Path}) {
$mime{Encoding} ||= 'base64';
$mime{Type} ||= File::Type->mime_type($mime{Path});
}
} else {
%mime = (
Path => $attachment,
Expand Down Expand Up @@ -265,8 +267,10 @@ Example:
};
The C<attach> value accepts either a single attachment or an arrayref
of attachment. Each attachment may be a scalar, with the path of the
file to attach, or an hashref, in which case the hashref is passed to
the L<Mime::Entity>'s C<attach> method.
=head1 CONTRIBUTORS
Expand Down

0 comments on commit ff12cdb

Please sign in to comment.