NAME

Solstice::Email - Send email with a resonable amount of ease.

SYNOPSIS

  use Solstice::Email;

  my $mailer = Solstice::Email->new();

  $mailer->from('From Address <sender@example.com>');
  $mailer->to(@email_addresses);
  $mailer->cc(@email_addresses);
  $mailer->bcc(@email_addresses);

  $mailer->subject('Subject!');

  $mailer->plainTextBody('Plain text version');
  $mailer->htmlBody('<b>HTML version!</b>');

  # This will make it so an image can be embedded in the HTML.
  # To reference the image in the HTML, use the something like the 
  # following:
  # <img src="cid:happy_user.png" />
  $mailer->attachMedia( content_type => 'image/png',
                        id           => 'happy_user.png',
                        path         => '/path/to/happy_user.png',
                        );

  $mailer->send();

  # For internal use, and perhaps some testing...
  my $server  = $mailer->getSMTPServer();
  my $from    = $mailer->getFrom();
  my @to      = $mailer->getTo();
  my @cc      = $mailer->getCC();
  my @bcc     = $mailer->getBCC();
  my $subject = $mailer->getSubject();
  my $text    = $mailer->getPlainTextBody();
  my $html    = $mailer->getHTMLBody();
  my @media   = $mailer->getAttachedMedia();

DESCRIPTION

This module was designed to make it easy to send HTML email, in a way that older mail clients would be able to read. It is designed to supercede the old Email module, which seems like it was written at a point when people still needed convincing that object encapsulation was a good idea.

Export

No symbols exported.

Methods

new()

Constructs a new Solstice::Email.

getMailName()

Returns the smtp server we will be using.

getSMTPServer()

Returns the smtp server we will be using.

from('from address')

Set the sender.

getFrom()

Returns the sender.

to(@addresses)

Set an array of recipients.

getTo()

Returns an array of address.

cc(@addresses)

Set an array of recipients.

getCC()

Returns an array of addresses.

bcc(@addresses)

Set an array of recipients.

getBCC()

Returns an array of addresses.

subject('subject')

Subject of the email.

getSubject()

Returns the subject of the email.

plainTextBody('text')

A version of the email for older clients.

getPlainTextBody()

Returns the plain text version of the message.

htmlBody('html')

A version of the email for shiny new clients.

getHTMLBody()

Returns the HTML version of the message.

attachMedia( content_type => 'image/type', id => 'file_name.img', path => '/path/to/file_name.img', )

Add an image to the email.

getAttachedMedia()

Returns an array of all media attached to this message.

enqueue

Places the mail in the mail queue

send()

Sends off the email.

Modules Used

Solstice::Configure, MIME::Lite, Net::SMTP.

AUTHOR

Catalyst Group, <catalyst@u.washington.edu>

VERSION

$Revision: 3364 $

COPYRIGHT

Copyright 1998-2007 Office of Learning Technologies, University of Washington

Licensed under the Educational Community License, Version 1.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at: http://www.opensource.org/licenses/ecl1.php

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.