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


Solstice documentation  | view source Contained in the Solstice distribution.

Index


NAME

Top

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

SYNOPSIS

Top

  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

Top

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

Top

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

VERSION

Top

$Revision: 3364 $

COPYRIGHT

Top


Solstice documentation  | view source Contained in the Solstice distribution.