NAME DADA::MailingList::Schedules


Synopsis

 my $mss = DADA::MailingList::Schedules->new(-List => 'listshortname');


Description

This module holds shared methods used for the Beatitude scheduled mailer. The rest of the methods are located in DADA::MailingList::Schedules::MLDb.


Public Methods

run_schedules

 my $report = $mss->run_schedules(-test => 0);

Returns a nicely formatted report of the schedules that were run.

If the -test argument is passed with a value of 1, the schedules will go until actual mailing.

mailing_schedule

 my $mailing_schedule = $mss->mailing_schedule($key);

returns a reference to an array of times that a schedule saved in $key has to be sent out.

printable_date

 $mss->printable_date($form_vals->{last_mailing})

returns a date that's pretty to look at, when given a number of seconds since epoch.

send_scheduled_mailing

 my ($mail_status, $checksums) 
        = $self->_send_scheduled_mailing(
                                                                        -key   => $rec_key, 
                                                                        -test  => 0, 
                                                                        -hold  => 1,
                                                                        );

Sends an individual schedule, as defined by the information in -key. if -hold is set to 1, mailing will be queued until all schedules are run. (should be set to 1). If -test is set to 1, only a test mailing (message to the list owner) will be run.


Private Methods

_send_held_messages

 $self->_send_held_messages;

messages are queued up before being sent. Calling this method will send these queed messages.

_build_email

 my ($send_flags, $checksums, $message) = $self->_build_email(-key => $key);

Creates an email message ($message) that can then be sent with DADA::Mail::Send. It also returns the hashref, $send_flags that will denote any problems with message building, as well as a MD5 checksum of the message itself.

_create_text_ver

my ($flags, $checksum, $headers, $message) = $self->_create_text_ver(-record => $record, -type => 'PlainText');

Creates the text part of an email, using the information saved in the $record record. Returns any problemswith building the message in $flags ($hashref), a checksum in $checksum, headers (hashref) in $headers and the actual message in $message. -type needs to be either PlaintText or HTML.

_from_file

 my $data = $self->_from_file($filename);

Grabs the contents of a file, returns contents.

_from_url

        my $data = $self->_from_url($url);

returns the $data fetched from a URL

_apply_template

        $data = $self->_apply_template(-type => PlainText, -data => $data,);

Applies a Mailing List Message template to -data. -type must be set to either PlainText or HTML

_parse_in_list_info

        $data = $self->_parse_in_list_info(-type => PlainText, -data => $data, );

Changes pseudo tags into their real values. -type must be set to either PlainText or HTML

_create_checksum

 my $cmp_cs = $self->_create_checksum($data_ref);

Returns an md5 checksum of the reference to a scalar being passed.

_virgin_check

 my $we_gotta_virgin = $self->_virgin_check($record->{$type . '_ver'}->{checksum}, \$data); 
        
Figures if a copy of a message has previously been sent, using the previous checksum value.

_grab_headers

 ($headers, $data) = $self->_grab_headers($data) if $record->{$type . '_ver'}->{grab_headers_from_message} == 1;
        
Splits the message in $data into headers and a body. 

_find_mime_type

 my $type = $self->_find_mime_type('filename.txt'); 

Attempts to figure out the MIME type of a filename.