1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
package Swatch::SendMail;
require 5.000;
require Exporter;
use strict;
use Carp;
use Mail::Sendmail;
use Sys::Hostname;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
@ISA = qw(Exporter);
@EXPORT = qw/
&send_mail
/;
$VERSION = '20031118';
################################################################
sub send_mail {
my $login = (getpwuid($<))[0];
my $host = hostname;
my %opts = (
'ADDRESSES' => $login,
'FROM' => "$login\@$host",
'SUBJECT' => 'Message from Swatch',
@_
);
(my $to_line = $opts{'ADDRESSES'}) =~ s/:/,/g;
my %mail = ( To => $to_line,
From => $opts{FROM},,
Subject => $opts{SUBJECT},
Message => $opts{MESSAGE},
);
sendmail(%mail) or warn $Mail::Sendmail::error;
return 0;
}
################################################################
## The POD ###
=head1 NAME
Swatch::SendMail - Swatch interface to the Mail::Sendmail module
=head1 SYNOPSIS
use Swatch::SendMail;
=head1 SWATCH SYNTAX
=head1 DESCRIPTION
=head1 AUTHOR
E. Todd Atkins, todd.atkins@stanfordalumni.org
=head1 SEE ALSO
perl(1), swatch(1).
=cut
1;
|