Bric::Dist::Action::Email - Class to email distribution resources
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);
This subclass of Bric::Dist::Action can be used to email distribution resources to one or more email addresses.
See Bric::Dist::Action.
The following class method is in addition to those provided by Bric::Dist::Action, and overrides the same method in that class.
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 = 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:
Address from whom email will be sent.
Addresses to whom email will be sent.
Addresses to whom email will be Cc'd.
Addresses to whom email will be Bcc'd.
Subject of the email to be sent.
The content type the email will be sent as.
Determines how text resources are to be handled.
Determines how non-text resources are to be handled.
The following accessors are in addition to those provided by Bric::Dist::Action.
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.
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.
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.
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.
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.
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.
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:
INLINEConcatenate the contents of all text resources and include the resulting string inlinex as the email message. The default value.
ATTACHAttach all text files to the email message.
IGNOREIgnore text resources.
The setter converts non-Unix line endings.
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:
IGNOREIgnore text resources. The default value.
ATTACHAttach all text files to the email message.
The setter converts non-Unix line endings.
$action = $action->do_it($job, $server_type);
Emails the resources (files) for a given job and server type.
Thows:
$action = $action->save;
Saves the action for the server type and job, along with all of its attributes.
Thows:
David Wheeler <david@kineticode.com>
Base class from which Bric::Dist::Action::Email inherits much of its interface.
Defines the types of actions that the Bricolage distribution supports, including emailing resources.
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.
Manages distribution jobs, including processing all the actions required for each destination for which resources are to be distributed.