summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2002-06-18 17:20:34 +0000
committerPeter Palfrader <peter@palfrader.org>2002-06-18 17:20:34 +0000
commitaccaa3d02049d5399e50839ea0951b2b5f97d5a1 (patch)
tree90ad71ae5cf2d5e6174eedc345d16466640ba011
parentba461ce2b7f7677cf16ef77bc4389666f82b977f (diff)
Build mail a bit different
-rw-r--r--Echolot/Tools.pm19
1 files changed, 10 insertions, 9 deletions
diff --git a/Echolot/Tools.pm b/Echolot/Tools.pm
index 2c82ac7..448b198 100644
--- a/Echolot/Tools.pm
+++ b/Echolot/Tools.pm
@@ -1,7 +1,7 @@
package Echolot::Tools;
# (c) 2002 Peter Palfrader <peter@palfrader.org>
-# $Id: Tools.pm,v 1.2 2002/06/11 09:54:17 weasel Exp $
+# $Id: Tools.pm,v 1.3 2002/06/18 17:20:34 weasel Exp $
#
=pod
@@ -110,7 +110,6 @@ sub send_message(%) {
if (defined $args{'Token'}) {
$args{'From'} = make_address( $args{'Token'} );
} else {
- cluck ("Sending messages without tokens?");
$args{'From'} =
Echolot::Config::get()->{'my_localpart'}.
'@'.
@@ -118,13 +117,15 @@ sub send_message(%) {
};
$args{'Subject'} = 'none' unless (defined $args{'Subject'});
- my $message = "To: $args{'To'}\n";
- $message .= "From: $args{'From'}\n";
- $message .= "Subject: $args{'Subject'}\n";
- $message .= "\n".$args{'Body'};
-
- my @lines = split (/\n/, $message);
- my $mail = new Mail::Internet ( \@lines );
+ 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 );
$mail->smtpsend( Host => Echolot::Config::get()->{'smarthost'} );
};