DADA::MailingList::Schedules

- NAME DADA::MailingList::Schedules
- Synopsis
- Description
- Public Methods

- run_schedules
- mailing_schedule
- printable_date
- send_scheduled_mailing

- Private Methods

- _send_held_messages
- _build_email
- _create_text_ver
- _from_file
- _from_url
- _create_checksum
- _virgin_check
- _grab_headers
- _find_mime_type

- COPYRIGHT

# 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 queued 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

## _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.

# COPYRIGHT

Copyright (c) 1999-2008 Justin Simoni All rights reserved.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.