From a532aec4ebe68b712a74ba9bad0839b90d4ef7a9 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Wed, 10 Jul 2002 21:46:28 +0000 Subject: Did away with Mail::Internet. Using local sendmail binary only --- Echolot/Config.pm | 4 ++-- Echolot/Tools.pm | 25 +++++++++++++------------ 2 files changed, 15 insertions(+), 14 deletions(-) (limited to 'Echolot') diff --git a/Echolot/Config.pm b/Echolot/Config.pm index 4d2f07a..b651d81 100644 --- a/Echolot/Config.pm +++ b/Echolot/Config.pm @@ -1,7 +1,7 @@ package Echolot::Config; # (c) 2002 Peter Palfrader -# $Id: Config.pm,v 1.21 2002/07/10 17:58:05 weasel Exp $ +# $Id: Config.pm,v 1.22 2002/07/10 21:46:28 weasel Exp $ # =pod @@ -62,7 +62,7 @@ sub init($) { hash_len => 8, addresses_default_ttl => 5, # getkeyconf seconds (days) check_resurrection_ttl => 8, # check_resurrection seconds (weeks) - smarthost => 'localhost', + sendmail => '/usr/sbin/sendmail', mailindir => 'mail', mailerrordir => 'mail-errors', fetch_new => 1, diff --git a/Echolot/Tools.pm b/Echolot/Tools.pm index 448b198..17a5980 100644 --- a/Echolot/Tools.pm +++ b/Echolot/Tools.pm @@ -1,7 +1,7 @@ package Echolot::Tools; # (c) 2002 Peter Palfrader -# $Id: Tools.pm,v 1.3 2002/06/18 17:20:34 weasel Exp $ +# $Id: Tools.pm,v 1.4 2002/07/10 21:46:28 weasel Exp $ # =pod @@ -19,7 +19,6 @@ use strict; use warnings; use Carp qw{cluck}; use Digest::MD5 qw{}; -use Mail::Internet; sub hash($) { my ($data) = @_; @@ -117,17 +116,19 @@ sub send_message(%) { }; $args{'Subject'} = 'none' unless (defined $args{'Subject'}); - my $head = new Mail::Header; - $head->add ( 'To', $args{'To'} ); - $head->add ( 'From', $args{'From'} ); - $head->add ( 'Subject', $args{'Subject'} ); - - my @lines = map { $_."\n" } split (/\r?\n/, $args{'Body'}); - my $mail = new Mail::Internet ( - Header => $head, - Body => \@lines ); + open(SENDMAIL, '|'.Echolot::Config::get()->{'sendmail'}.' -f '.$args{'From'}.' -t') + or cluck("Cannot run sendmail: $!"), + return 0; + printf SENDMAIL "From: %s\n", $args{'From'}; + printf SENDMAIL "To: %s\n", $args{'To'}; + printf SENDMAIL "Subject: %s\n", $args{'Subject'}; + printf SENDMAIL "\n"; + for my $line (@lines) { + print SENDMAIL $line; + }; + close SENDMAIL; - $mail->smtpsend( Host => Echolot::Config::get()->{'smarthost'} ); + return 1; }; 1; -- cgit v1.2.3