Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

cwest (1514)

cwest
  (email not shown publicly)
http://caseywest.com/
AOL IM: caseyrwest (Add Buddy, Send Message)

Perl geek.

Journal of cwest (1514)

Tuesday May 10, 2005
10:26 PM

JDFI Week: Days 3-9

[ #24624 ]
  • Email-Send alpha released. OO interface. Here is the synopsis.

use Email::Send;

my $message = <<'__MESSAGE__';
To: recipient@example.com
From: sender@example.com
Subject: Hello there folks

How are you? Enjoy!
__MESSAGE__

my $sender = Email::Send->new({mailer => 'SMTP'});
$sender->mailer_args([Host => 'smtp.example.com']);
$sender->send($message);

# more complex
my $bulk = Email::Send->new;
for ( qw[SMTP Sendmail Qmail] ) {
    $bulk->mailer($_) and last
      if $bulk->mailer_available($_);
}

$bulk->message_modifier(sub {
    my ($sender, $message, $to) = @_;
    $message->header_set(To => qq[$to\@geeknest.com])
});

my @to = qw[casey chastity evelina casey_jr marshall];
my $rv = $bulk->send($message, $_) for @to;

I expect there to be at least two more RC releases of the distribution. It still needs a little more work. Feel free to take a look and comment.

As you can see with the message_modifier() method I tried to address the idea of sending email in bulk. I can see where someone might choose to do a mail merge with Template Toolkit. This method would help with that. It is maximum flexibility.

In any case, JDFI week has been extended. :-)

Posted from caseywest.com, comment here.

New comment creation has been disabled on this discussion.
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login
Loading... please wait.