Brad Fitzpatrick > TheSchwartz-Worker-SendEmail > TheSchwartz::Worker::SendEmail

Download:
TheSchwartz-Worker-SendEmail-1.00.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 1.00   Source  

NAME ^

TheSchwartz::Worker::SendEmail - sends email using SMTP

SYNOPSIS ^

  use TheSchwartz;
  use TheSchwartz::Worker::SendEmail;
  TheSchwartz::Worker::SendEmail->set_HELO("example.com");
  my $sclient = TheSchwartz->new(databases => \@Conf::YOUR_DBS);
  $sclient->can_do("TheSchwartz::Worker::SendEmail");
  $sclient->work; # main loop of program; goes forever, sending email

DESCRIPTION ^

This is a worker class for sending email (designed for lots of email) using TheSchwartz job queue and a slightly-tweaked subclass of Net::SMTP. See TheSchwartz for more information.

JOB ARGUMENTS ^

When constructing a SendEmail job using TheSchwartz's insert_job method, construct your TheSchwartz::Job instance with its 'argument' of the following form:

   {
      # recipients:
      rcpts    => [ $email1, $email2, ... ],
      env_from => $envelope_from_address,
      data     => $headers_and_body_as_big_string,
   }

Note that "Bcc:" headers will be removed, and a "Message-ID" header will be added if not present, but nothing else is magical. This module does no MIME, etc. There are other modules for that.

CLASS METHODS ^

set_resolver

   TheSchwartz::Worker::SendEmail->set_resolver($net_dns_resolver_obj)

Sets the DNS resolver object to use. By default, just uses a new Net::DNS::Resolver.

set_HELO

   TheSchwartz::Worker::SendEmail->set_HELO("example.com");

Sets the domain to announce in your HELO.

set_on_5xx

    TheSchwartz::Worker::SendEmail->set_on_5xx(sub {
        my ($email, $thesch_job, $smtp_code_space_message) = @_;
    });

Set a subref to be run upon encountering a 5xx error. Arguments to your subref are the email address, TheSchwartz::Job object, and a scalar string of the form "SMTP_CODE SMTP_MESSAGE". The return value of your subref is ignored.

AUTHOR ^

Brad Fitzpatrick -- brad@danga.com

COPYRIGHT, LICENSE, and WARRANTY ^

Copyright 2006-2007, SixApart, Ltd.

License to use under the same terms as Perl itself.

This software comes with no warranty of any kind.

SEE ALSO ^

TheSchwartz

syntax highlighting: