NAME

MOJO::Mail


SYNOPSIS

        use MOJO::Mail
        my $mh = MOJO::Mail->new;

Mail Routines for the Mojo Mail MLM, UC?


DESCRIPTION

Cool name huh? You have found the heart of the beast, this is where ALL mailings will find themselves, one way or another, let's see if we can get this all straightened out so you can customize this to your heart's delight. Follow me...

First off, there are TWO different ways mailings happen, either by sending one e-mail, using the send() method, or when sending to a group, using the bulk_send() method. This is somewhat of a fib, since mailings called by bulk_send() actually use the send() method to do its dirty work. Well, that is, if you're not using a SMTP feature, then both the send() and bulk_send() have their own way of doing it... kinda.

MOJO::Mail uses the Mail::Bulkmail CPAN module, written by James A Thomason III (thomasoniii@yahoo.com) for ALL its SMTP services. And we pretty much love him for that.

PLEASE NOTE That the version of Mail::Bulkmail.pm provided in this distribution IS NOT the same version as is on CPAN, the version in this distribution has 2 bug fixes, one relating to having the correct date applied to messages, the other relating to the fact that there are top level domains with more than 3 letters in 'em.

You create a single address object like so:

        my $mh = MOJO::Mail->new(\%list_info); 
        my %mailing = (
        To       => 'justin@skazat.com', 
        From     => 'alex@prolix.nu', 
        Subject  => 'party over here!', 
        Body     => 'yo yo yo, wheres the flava at? we need some action!', 
        ); 
        $mh->bulk_send(%mailing);

Pretty fricken hard eh? Well, it can get a bit harder than that, but thats a pretty stripped down version, If you wanted, you could theoretically use this as a do all mail sender + all the features that are in the Guts.pm module. Its pretty easy to make some crazy... stuff once you've got a handle on it.


new

new should take a reference to a hash which is the list settings hash, gotten from open_database() in Guts.pm. Why? cause the list settings have all sorts of... well settings to change how things get sent. Can you call this module without this hash reference? Yes! you may, you can even fib the hash reference, if you want:

        my $mh = MOJO::Mail->new({this => 'that'})

please note that you need at least a list name for bulk sending. The list name is needed to open the actual subscription list to send out to people.

you can use just the send() method without anything passed to new


Default Headers

MOJO::Mail has a wide variety of both e-mail headers you can send to it. you do this through either the send() or bulksend() methods


Handy Dandy Methods

These methods are used to change how Mojo Mail sends mostly Bulk messages, these are the fun ones,

return_headers

        my %headers = $mh->return_headers($string);

This is a funky little subroutine that'll take a string that holds the header of a mail message, and gives you back a hash of all the headers seperated, each key in the hash holds a different header, so if I say

        my $mh = MOJO::Mail -> new(); 
        my %headers = $mh -> return_headers($header_glob);

I can then say:

        my $to = $headers{To};

This subroutine is used quite a bit to take out put from the MIME::Lite module, which allows you to get the whole header with its header_to_string() subroutine and hack it up into something Mojo Mail can use.

clean_headers

        %squeaky_clean_headers = $mh->clean_headers(%these_be_the_heaers);

this method does a little munging to the mail headers for better absorbtion; basically, it changes the case of some of the mail headers so everyone's on the same page

send

This method sends an email, it takes a hash of the mail headers, plus the body of the message:

$mh->send(To => 'justin@skazat.com',
From => 'secret@admirer.com',
Subject => 'smooch!',
Body => 'you are so cute, you little Perl Coder you'
);

bulk_send

Sends a message to everyone on your list, (that you specified, by passing a hash ref with the list settings.. right?)

Takes the same arguments as send()


COPYRIGHT

Copyright (c) 1999 - 2002 Justin Simoni (justin@skazat.com) http://skazat.com

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.


CONTACT INFO

Justin Simoni http://skazat.com justin\@skazat.com

A good place to start to get information is at:

http://mojo.skazat.com