DADA::Mail::MailOut - Helps Monitor a Mass Mailout
Refer to the version of Dada Mail that this module comes in.
# A few subroutines, exported by default: my @mailouts = DADA::Mail::MailOut::current_mailouts($list); my $exists = DADA::Mail::MailOut::mailout_exists($list, $id, $type); # Create a new DADA::Mail::MailOut object: my $mailout = DADA::Mail::MailOut->new(-List => $list); # Make a new Mailout: $mailout->create( -fields => {%fields}, -list_type => 'list', -mh_obj => $mh_obj, ); # how's that mailout doin'? my $status = $mailout->status; # do I need to reload the mailout? my $yes_restart = $mailout->should_be_restarted; # if so, let's do that: if($yes_restart){ $mailout->reload('list'); }
This module does a few things, all of which happen to deal with setting up a mass mailing and then monitoring its status.
Mass Mailings do take a while and the CGI environment that Dada Mail is run in, isn't the best thing to be in during a long-running process, like mail sending to a few thousand of your closest friends.
Because of that, this module attempts to keep close track of how the mailing is doing and give an option to reload a mailing at the time it stopped. Mailings usually stop because the mailing process itself can be killed by the server itself.
The create()
method does most of the magic in getting a mailing setup. When
called correctly, it will make a temporary directory (usually in $TMP that
holds within it the following files:
This subscriber list does not just hold the email address of a subscriber, but other meta information, like the pin associated with the subscriber, amongst other things.
See the DADA::MailingList::Subscribers::[..]::create_bulk_sending_file()
http://mojo.skazat.com/support/documentation/MailingList_Subscribers_PlainText.pm.html
method for exactly how this is made.
time()
that a mailout started.
time()
perl builtin,
every time countsubscriber()
is called.
This file is basically used to make sure that a mailing process is still going on. If the time saved in this file becomes too long, a mailing may become ripe for a reload().
Takes one argument - the list shortname, ala:
my $mailout = DADA::Mail::MailOut->new({-List => 'listshortname'});
All there is to it.
Note! that a MailOut object is pretty useless, until you call the, create() method.
Used to setup, or, ``create'' a mailout. Makes all the temporary files and directories need. Needs a few things passed - do pay attention, since what it needs is slightly odd:
$mailout->create( -fields => {%fields}, -list_type => 'list', -mh_obj => $mh_obj, );
This is a fairly odd format to have everything in, but it's sort of native to DADA::Mail::Send and that's the module most likely to be calling create().
You'll most likely never call create()
yourself, but that's the jist of it.
Although you may never call create, calling status may be much more commonplace.
my $status = $mailout->status;
or even:
foreach(keys %{$mailout->status}){ print $_; # or... something... }
status returns a hashref of various information about your mailout. Best not to call this too many times at once, as it does query all those temporary files we've created. I'll go over what you're most likely going to use:
time()
when we create()d the mailout.
reload()
when this is set to, ``1'', the module will croak. So... don't.
my $status = $mailout->status; if($status->{should_be_restarted} == 1){ $mailout->reload({ reload args... }); }
Please report problems to the author of this module
Justin Simoni
See: http://mojo.skazat.com/contact
Copyright (c) 2006 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.