NAME

Email::MIME::Kit::Bulk::Target - Destination for an Email::MIME::Kit::Bulk email

VERSION

version 0.0.3

SYNOPSIS

use Email::MIME::Kit::Bulk::Target;

my $target = Email::MIME::Kit::Bulk::Target->new(
    to => 'someone@somewhere.com',
    cc =>  [ 'someone_else@somewhere.com' ],
    bcc => [ 'sneaky@somewhere.com' ],
    from => 'me@somewhere.com',
    language => 'en',
    template_params => {
        greetings => 'Hi',
    },
    extra_attachments => [ 'foo.pdf' ] 
);

Email::MIME::Kit::Bulk->new(
    kit => '/path/to/mime/kit',
    processes => 5,
    targets => [ $target ],
)->send;

DESCRIPTION

A Email::MIME::Kit::Bulk object will produce one email for every Email::MIME::Kit::Bulk::Target object it is given. Each target object defines the recipients of the email, and can also be take attachments, specific From address and custom parameters for the MIME kit template.

METHODS

new( %args )

Constructor.

Arguments

to => $email_address

To Email address. Can be a string or a MooseX::Types::Email::EmailAddress object.

Required.

cc => \@email_addresses

Cc Email addressses. Array ref of MooseX::Types::Email::EmailAddress objects.

bcc => \@email_addresses

Bcc Email addressses. Array ref of MooseX::Types::Email::EmailAddress objects.

from => $email_address

Address to use for the From originator. Must be a MooseX::Types::Email::EmailAddress object.

language => $lang

Language to use for this target.

template_params => \%params

Parameters to be passed to the Email::MIME::Kit template.

extra_attachments => \@attachments

Attachments to add to the email for this target.

to()

Returns the MooseX::Types::Email::EmailAddress object for the To recipient.

cc()

my @cc = $target->cc;

Returns the list of MooseX::Types::Email::EmailAddress objects for the Cc recipients.

bcc()

my @bcc = $target->bcc;

Returns the list of MooseX::Types::Email::EmailAddress objects for the Bcc recipients.

from()

my $from = $target->from;

Returns the MooseX::Types::Email::EmailAddress object for the From originator.

language()

my $lang = $target->language;

Returns the language set for the target.

has_language()

Returns true if a language was set for the target.

template_params()

Returns the hash ref of the parameters that will be passed to the Email::MIME::Kit template.

extra_attachments()

Returns the list of extra attachments that will be added to the email for this target.

recipients

Returns all the recipients (To, Cc and Bcc combined) of the email.

AUTHORS

  • Jesse Luehrs <doy@cpan.org>

  • Yanick Champoux <yanick.champoux@iinteractive.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2017 by Infinity Interactive <contact@iinteractive.com>.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.