App::Basis::Email
use Text::Markdown qw(markdown); use App::Basis::Email ; my $markdown = <<EOD ; # Basic Markdown ![BBC Logo](http://static.bbci.co.uk/frameworks/barlesque/2.60.6/orb/4/img/bbc-blocks-light.png) 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 );
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.
kevin mulholland
if you want templating then do it outside of this module and pass the formatted HTML/markdown in
To create email I use Email::MIME::CreateHTML, you may need to force this to install it as there is a slight test bug To send email I use Email::Sender::Simple with Email::Sender::Transport::SMTP and Email::Sender::Transport::Sendmail Markdown processing is done with Text::Markdown
Create a new instance of the email
my $mail = App::Basis::Email->new( host => "email.server.fred", port => 25 );
Parameters host ip address or hotsname of your SMTP server port optional port number for SMTP, defaults to 25 ssl use SSL mode user user for ssl passwd password for ssl testing flag to show testing mode, prevents sending of email
send the required email
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 );
Any data that is in the hash is passed to the server, though some may be re-interpreted as mentioned in the DESCRIPTION
Parameters to email address to (can be array of email addresses) cc email cc list (can be array of email addresses) from email address from subject subject for the email text teset message to send, for email clients that do not do html html html message to send markdown markdown message to send, converted to html and replaces it css_file link to a css file to use for HTML/markdown files
Returns status - true = Sent, false = Failed (string of email message if testing flag used)
To install App::Basis::Email, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::Basis::Email
CPAN shell
perl -MCPAN -e shell install App::Basis::Email
For more information on module installation, please visit the detailed CPAN module installation guide.