[interchange-cvs] interchange - jonc modified lib/Vend/Util.pm
interchange-cvs at icdevgroup.org
interchange-cvs at icdevgroup.org
Fri Jan 28 20:08:49 EST 2005
User: jonc
Date: 2005-01-29 01:08:49 GMT
Modified: lib/Vend Util.pm
Log:
Improvements to Net::SMTP email method:
* Net:SMTP debug messages output to global debug file when in
Interchange debug mode.
* Stop double hello if MV_HELO is specified.
* Fall back on SERVER_NAME if no MV_HELO is specified - much nicer
than the Net::SMTP default of 'localhost.localdomain'.
* Add in From address to mail header.
* Add timestamp to mail header.
Revision Changes Path
2.77 +7 -5 interchange/lib/Vend/Util.pm
rev 2.77, prev_rev 2.76
Index: Util.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Util.pm,v
retrieving revision 2.76
retrieving revision 2.77
diff -u -r2.76 -r2.77
--- Util.pm 7 Jan 2005 21:26:07 -0000 2.76
+++ Util.pm 29 Jan 2005 01:08:49 -0000 2.77
@@ -1,6 +1,6 @@
# Vend::Util - Interchange utility functions
#
-# $Id: Util.pm,v 2.76 2005/01/07 21:26:07 mheins Exp $
+# $Id: Util.pm,v 2.77 2005/01/29 01:08:49 jonc Exp $
#
# Copyright (C) 2002-2003 Interchange Development Group
# Copyright (C) 1996-2002 Red Hat, Inc.
@@ -87,7 +87,7 @@
use Vend::File;
use subs qw(logError logGlobal);
use vars qw($VERSION @EXPORT @EXPORT_OK);
-$VERSION = substr(q$Revision: 2.76 $, 10);
+$VERSION = substr(q$Revision: 2.77 $, 10);
my $Eval_routine;
my $Eval_routine_file;
@@ -1869,7 +1869,7 @@
SMTP: {
my $mhost = $::Variable->{MV_SMTPHOST} || $Global::Variable->{MV_SMTPHOST};
- my $helo = $Global::Variable->{MV_HELO};
+ my $helo = $Global::Variable->{MV_HELO} || $::Variable->{SERVER_NAME};
last SMTP unless $none and $mhost;
eval {
require Net::SMTP;
@@ -1880,8 +1880,7 @@
#::logDebug("using $using");
undef $none;
- my $smtp = new Net::SMTP $mhost;
- $smtp->hello($helo) if $helo;
+ my $smtp = Net::SMTP->new($mhost, Debug => $Global::Variable->{DEBUG}, Hello => $helo);
#::logDebug("smtp object $smtp");
my $from = $::Variable->{MV_MAILFROM}
@@ -1893,6 +1892,9 @@
next unless /^From:\s*(\S.+)$/mi;
$from = $1;
}
+ push @extra_headers, "From: $from" unless (grep /^From:\s*(\S.+)$/i, @extra_headers);
+ push @extra_headers, 'Date: ' . Vend::Interpolate::mvtime() unless (grep /^Date:\s*.$/i, @extra_headers);
+
my $mime = '';
$mime = Vend::Interpolate::mime('header', {}, '') if $use_mime;
$smtp->mail($from)
More information about the interchange-cvs
mailing list