App-Basis-Email
view release on metacpan or search on metacpan
lib/App/Basis/Email.pm view on Meta::CPAN
# ABSTRACT: Simple email sending, nothing special
=head1 NAME
App::Basis::Email
=head1 SYNOPSIS
use Text::Markdown qw(markdown);
use App::Basis::Email ;
my $markdown = <<EOD ;
# Basic Markdown

That was an inlined image
## level2 header
* bullet
* sub-bullet
### level3 header
EOD
my $html = markdown($markdown);
my $mail = App::Basis::Email->new( hostname => 'my.email.server', port => 25 ) ;
my $status = $mail->send(
from => 'fred@fred.test.fred',
to => 'fred@fred.test.fred',
subject => 'test HTML email, with inline images',
html => $html
);
=head1 DESCRIPTION
Sending email should be simple, sending formatted email should be simple too.
I just want to be able to say send this thing via this process.
This module provides that, a way to simply send email (plain/html or markdown) via
either a SMTP or sendmail target.
Obviously I do nothing new, just wrap around existing modules, to make life simple.
=head1 AUTHOR
kevin mulholland
=head1 Notes
if you want templating then do it outside of this module and pass the formatted
HTML/markdown in
=head1 See Also
To create email I use L<Email::MIME::CreateHTML>, you may need to force this to
install it as there is a slight test bug
To send email I use L<Email::Sender::Simple> with L<Email::Sender::Transport::SMTP> and L<Email::Sender::Transport::Sendmail>
Markdown processing is done with L<Text::Markdown>
=over 4
=cut
package App::Basis::Email;
$App::Basis::Email::VERSION = '0.3';
use 5.010;
use warnings;
use strict;
use Moo;
use Try::Tiny;
use Email::Sender::Simple qw(sendmail);
use Email::Sender::Transport::SMTP qw();
use Email::Sender::Transport::Sendmail;
use Email::MIME::CreateHTML;
use Text::Markdown 'markdown';
use HTML::Restrict;
# ----------------------------------------------------------------------------
# what host name are we connecting to, defaults to localhost
has host => ( is => 'ro', );
# on what port
has port => (
is => 'ro',
default => sub { 25 },
);
# do we want to use SSL
has ssl => (
is => 'ro',
default => sub { 0 },
);
# SSL needs a user
( run in 2.291 seconds using v1.01-cache-2.11-cpan-d7a12ab2c7f )