Name

Bric::Dist::Action::Email - Class to email distribution resources

Synopsis

use Bric::Dist::Action::Email;

my $id = 1; # Assume that this is an Email action.
# This line will automatically instantiate the correct subclass.
my $action = Bric::Dist::Action->lookup({ id => $id });

# Set up the action.
$action->set_from('me@example.com');
$action->set_to('you@example.net');

# Perform the action on a list of resources.
$action = $action->do_it($resources_href);

# Undo is a no-op.
$action = $action->undo_it($resources_href);

Description

This subclass of Bric::Dist::Action can be used to email distribution resources to one or more email addresses.

Class Interface

Constructors

See Bric::Dist::Action.

Class Methods

The following class method is in addition to those provided by Bric::Dist::Action, and overrides the same method in that class.

has_more

if (Bric::Dist::Action::Email->has_more) {
    print "It has more attributes than Bric::Dist::Action\n";
}

Returns true to indicate that this action has more properties than does the base class (Bric::Dist::Action).

my_meths

my $meths = Bric::Dist::Action::Email->my_meths
my @meths = Bric::Dist::Action::Email->my_meths(1);
my $meths_aref = Bric::Dist::Action::Email->my_meths(1);
@meths = Bric::Dist::Action::Email->my_meths(0, 1);
$meths_aref = Bric::Dist::Action::Email->my_meths(0, 1);

Returns Bric::Dist::Action::Email attribute accessor introspection data. See Bric for complete documentation of the format of that data. Returns accessor introspection data for the following attributes:

from

Address from whom email will be sent.

to

Addresses to whom email will be sent.

cc

Addresses to whom email will be Cc'd.

bcc

Addresses to whom email will be Bcc'd.

subject

Subject of the email to be sent.

content_type

The content type the email will be sent as.

handle_text

Determines how text resources are to be handled.

handle_other

Determines how non-text resources are to be handled.

Instance Interface

Accessors

The following accessors are in addition to those provided by Bric::Dist::Action.

from

my $from = $action->get_from;
$action = $action->set_from($from);

Get and set the address from which email will be sent. Optional. The setter converts non-Unix line endings.

to

my $to = $action->get_to;
$action = $action->set_to($to);

Get and set the address or addresses to which email will be sent. Multiple addresses should be separated by commas. Either to or bcc or both are required. The setter converts non-Unix line endings.

cc

my $cc = $action->get_cc;
$action = $action->set_cc($cc);

Get and set the address or addresses to which email will be Cc'd. Multiple addresses should be separated by commas. Optional. The setter converts non-Unix line endings.

bcc

my $bcc = $action->get_bcc;
$action = $action->set_bcc($bcc);

Get and set the address or addresses to which email will be Bcc'd. Multiple addresses should be separated by commas. Either to or bcc or both are required. The setter converts non-Unix line endings.

subject

my $subject = $action->get_subject;
$action = $action->set_subject($subject);

Get and set the subject to be used when emails are sent. Optional. The setter converts non-Unix line endings.

content_type

my $content_type = $action->get_content_type;
$action = $action->set_content_type($content_type);

Get and set the content type to be used when emails are sent. If not specified, Bric::Dist::Action::Email will use the media type of the first text file it uses for the email message. The setter converts non-Unix line endings.

handle_text

my $handle_text = $action->get_handle_text;
$action = $action->set_handle_text($handle_text);

Get and set the constant value that determines how text resources are handled. All files with a media type starting with "text/" are considered text files. The possible values for this attribute are available via the constants defined for this class:

INLINE

Concatenate the contents of all text resources and include the resulting string inlinex as the email message. The default value.

ATTACH

Attach all text files to the email message.

IGNORE

Ignore text resources.

The setter converts non-Unix line endings.

handle_other

my $handle_other = $action->get_handle_other;
$action = $action->set_handle_other($handle_other);

Get and set the contant value that deterimines how non-text resources, such as image files, are handled. All files with a media type that does not start with "text/" are considered non-text files. The possible values for this attribute are available via the constants defined for this class:

IGNORE

Ignore text resources. The default value.

ATTACH

Attach all text files to the email message.

The setter converts non-Unix line endings.

Other Instance Methods

do_it

$action = $action->do_it($job, $server_type);

Emails the resources (files) for a given job and server type.

Thows:

Exception::DA

save

$action = $action->save;

Saves the action for the server type and job, along with all of its attributes.

Thows:

Exception::DA

Author

David Wheeler <david@kineticode.com>

See Also

Bric::Dist::Action

Base class from which Bric::Dist::Action::Email inherits much of its interface.

Bric::Dist::ActionType

Defines the types of actions that the Bricolage distribution supports, including emailing resources.

Bric::Dist::ServerType

Defines the interface for Bricolage distribution destinations, including a list of actions to be performed before distributing to a given destination, as well as a list of servers for that destination.

Bric::Util::Job::Dist

Manages distribution jobs, including processing all the actions required for each destination for which resources are to be distributed.