8 our @EXPORT = qw(&sendMail);
10 checkConf( [ 'from_addr', 'sendmail' ] );
11 defConf( { 'sendmail' => '/usr/sbin/sendmail' } );
14 my( $to, $subject, $body ) = @_;
15 my( $from, $sendmail ) = confList( [ 'from_addr', 'sendmail' ] );
17 ( $error, $to ) = emailCheck( $to, undef );
18 die "Invalid email in database $to\n" if defined $error;
19 $body =~ s/^\.$/../gm;
20 open SENDMAIL, "|$sendmail -f$from $to" or die 'Can not send mail';
21 print SENDMAIL "From: $from\n".
23 "Subject: $subject\n".
24 "Content-Type: text/plain; charset=\"utf8\"\n".
27 close SENDMAIL or die "Sending mail failed: $!, $?";