Method: $sender->easy()

Same hashref as email() but called with a Mail::Sender object you created previously:

my $sender = Mail::Sender->new();

$sender->easy(\%email) or die "Email error: $@";

\%email

The keys to this hash are the keys described in Mail::Sender's docs in the "Parameters" Section with the addition of 3 new ones:

_text

The value is the text/plain part of the message, its the only required one.

_html

The value is the text/html part of the message, it is not required.

_text_info

Value is a hashref of additonal args to Mail::Sender->Part() for text in text and html emails, Mail::Sender->Body() in text with attachement. ctype, disposition, msg are ignored since they are set by other means.

The perfect place to set 'encoding' and 'charset'

_html_info

Value is a hashref of additonal args to Mail::Sender->Part() for html. ctype, disposition, msg are ignored since they are set by other means.

The perfect place to set 'encoding' and 'charset'

_attachments

Encoding of attachments is always Base64. The value of this key is a hash reference.

In that hashref each key is a filename, not the entire path, just the filename, to be attached. The value is another hashref described below. (Don't panic, its not as complex as it sounds at this point, see the EXAMPLE to see what I mean.)

_attachments => { 'file.name' => { this hash is described here }, }

You *must* specify the "file" key or the "msg" key, the "msg" key takes precedence.

The keys are:

file

Path to the file to attach.

'file' => '/home/foo/docs/fiddle.txt',

Makes the attachment via Mail::Sender::Attach()

msg

Contents of the file (instead of using a path)

'msg' => $fiddle_txt_content,

Makes the attachment via Mail::Sender::Part()

ctype

Content type of the attachement

'ctype' => 'image/png',

Mail::Sender will guess if not specified but its a good idea to specify it.

Defaults to text/plain

description

Short textual description or title of this file:

'description' => 'Fiddle Info',

Defaults to the filename you used for this hashref's key (IE "file.name" from the "this hash described here" header).

_disptype

Short textual description of the type of file:

'_disptype' => 'Text Document',

Defaults to the filename you used for this hashref's key (IE "file.name" from the "this hash described here" header).

_inline

The value is used as its "cid" and makes it attached inline

'_inline' => 'fiddlepic1',

in the html section:

<img src="cid:fiddlepic1" />

If not specified its not "inline", its just attached :)

The _disptype and _inline are used to build the actual "dispositon" part which is described in Mial::Sender's docs if you want to know the nitty gritty.

EXPORT

None by default. email() is exportable

EXAMPLE

Send an email via SMTP with authentication, on an alternate port, a plain text part, html part that has an inline smiley image, a PDF attachment, a high priority and read and delivery receipt request:

EXTENDED DESCRIPTION

Mail::Sender is a great module. I have great respect for Jenda as you can tell from the list archives :)

Mail::Sender's one problem is its a bit cumbersome to use, with so many options and things to open, close, the whole thing, parts, multiparts etc etc., and several ways to check for successs. Its hard to remember what needs done at what point with what data to do what you want and then which way you check what data based on what was done to see if it worked or not.

This module's aim is to make all of that ``Easy'', Simple, User Friendly, etc etc (see "DISCUSSION OF THE NAMESPACE" below)

It does so by providing a single function (and method) to send mail based on an (IMHO) easier to work with hashref and returns true or false on success or failer and sets $@ to any errors.

The EXAMPLE section shows an ``email or die'' that will send an email using SMTP Auth on port 26 with text and html parts, the html part has a smiley gif embedded inline and a PDF attached and a high priority flag and read and delivery receipt requests. It will take you seconds to customize it to send that to yourself (and its ``Easy'' to understand what its going on without having to understand the intracacies of SMTP and MIME messages. Now try it with plain the Mail::Sender manpage. See? Much much ``Easy''ier to do, understand, troubelshoot, maintain, etc etc :)

DISCUSSION OF THE NAMESPACE

When first registering this name space I was told Easy and Simple are bad name spaces, but Simple did seem to describe it in the spirit of LWP::Simple (I'd missed Adam's response for some reason...)

After receiveing no further recommendation of a registerable NS as requested I attempted "Friendly" with a request that if that was no good to please recommend something that is proper and was met with stone cold silence as of this rant being typed Sat Jan 7 16:24:28 CST 2006.