The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

Name

CatalystX::Usul::TraitFor::Email - Role for sending emails

Version

Describes v0.17.$Rev: 1 $

Synopsis

   package YourApp::Model::YourModel;

   use CatalystX::Usul::Moose;

   extends qw(CatalystX::Usul::Model);
   with    qw(CatalystX::Usul::TraitFor::Email);

   sub your_method {
      my $self = shift; $recipient = $self->send_email( $args ); return;
   }

Description

Provides utility methods to the model and program base classes

Configuration and Environment

Requires the loc method

Subroutines/Methods

send_email

   $recipient = $self->send_email( $args );

Sends emails. Returns the recipient address, throws on error. The $args hash ref uses these keys:

attachments

A hash ref whose key/value pairs are the attachment name and path name. Encoding and content type are derived from the file name extension

attributes

A hash ref that is applied to email when it is created. Typical keys are; content_type and charset

body

Text for the body of the email message

from

Email address of the sender

mailer

Which mailer should be used to send the email. Defaults to SMTP

mailer_host

Which host should send the email. Defaults to localhost

stash

Hash ref used by the template rendering to supply values for variable replacement

subject

Subject string

template

If it exists then the template is rendered and used as the body contents

to

Email address of the recipient

Diagnostics

None

Dependencies

CatalystX::Usul::Constants
Email::Sender::Transport::SMTP
Email::MIME
MIME::Types
Template

Incompatibilities

There are no known incompatibilities in this module

Bugs and Limitations

There are no known bugs in this module. Please report problems to the address below. Patches are welcome

Author

Peter Flanigan, <Support at RoxSoft.co.uk>

License and Copyright

Copyright (c) 2014 Peter Flanigan. All rights reserved

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic

This program is distributed in the hope that it will be useful, but WITHOUT WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE