Re: Mail::Preconfigured

2005-03-01 Thread Eric Wilhelm
# The following was supposedly scribed by
# Eric Wilhelm
# on Monday 28 February 2005 10:57 pm:

This is really intended for cron and other fully-automatic
(webserver/daemon triggered) jobs where you want mail to be sent via
 an external smtp server (and don't want to mess with sendmail.)
  Because of the YAML config file support, you can define the owner's
 (your) address and smtp username/password info in a single place
 instead of in every script.

Maybe it would be more useful if it used either Net::SMTP or 
Net::SMTP_auth depending on whether your config file had an 'auth' 
entry in it?

--Eric
-- 
Beware of bugs in the above code; I have only proved it correct, not 
tried it. 
 -- Donald Knuth
-
http://scratchcomputing.com
-


Mail::Preconfigured

2005-02-28 Thread Eric Wilhelm
Oh wise and potent module namers...

I have a module that uses Net::SMTP_auth and basically implements the 
following interface:

  # This assumes settings (such as [EMAIL PROTECTED])
  # are found in your ~/.mrmailer.conf (or /etc/...)
  my $mail = Mail::MrMailer-new()
  ... # productive stuff
  if($error) {
# you'll be the only one to get this:
$mail-maildie(error happened:  $error);
  }
  # you'll get a bcc of this:
  $mail-send_msg({to = $recip, cc = $mail-var('boss')}, 
join(\n, 
  Everything is okay.,
  I'm taking tomorrow off., ,
  --Eric, 
  ));

This is really intended for cron and other fully-automatic 
(webserver/daemon triggered) jobs where you want mail to be sent via an 
external smtp server (and don't want to mess with sendmail.)  Because 
of the YAML config file support, you can define the owner's (your) 
address and smtp username/password info in a single place instead of in 
every script.

The usual questions apply:
  How useful is this?
  What should I name it?

I've looked at:
  Email::Send::SMTP::Auth
too messy, no config-file support
  Mail::Send*
too full-service/procedural

I've also played with the idea of defining some signal handlers or other 
IO-magic which would allow you to send mail on a standard die() call or 
maybe use some kind of severity threshold to only send warnings which 
go above a given threshold.  (but maybe that's another module?)

Maybe it goes in IO::?

--Eric
-- 
It is a mistake to allow any mechanical object to realize that you are 
in a hurry. 
  -- Ralph's Observation
-
http://scratchcomputing.com
-