HEX
Server: Apache
System: Linux wp02.tdr-lab.com 3.10.0-1160.42.2.el7.x86_64 #1 SMP Tue Sep 7 14:49:57 UTC 2021 x86_64
User: kusanagi (1001)
PHP: 7.4.23
Disabled: NONE
Upload Files
File: //usr/share/doc/swatch-3.2.3/examples/SendMail.pm
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;