In <Pine.LNX.3.91.950820220308.853B-100000@kjahds.com>
On Sun, 20 Aug 1995 22:06:18 -0400 (EDT)
Kenneth Albanowski <kjahds@kjahds.com> writes:
>Grahm, I haven't received word from you yet, so I'm trying another
>message: perlbug has been converted over to MailUtils (and is much more
>strict, Tom) but Mail::Util::maildomain has a couple of glitches: first,
>if either SMTP lookup fails because of an invalid address (unable to
>resolve "localhost" or "mailhost" then you get a warning message on the
>screen, and secondly, if it falls back to Sys::Domainname, then it only
>returns a domain name, and not a host, unlike the SMTP mail domains,
>which include hosts.
Apply this patch in the MailTools-1.02a directory this should improve
maildomain. It now also looks in /etc/sendmail.cf if it exists before
calling smtp.
This patch will not fix the warnings from the Net::SMTP module (just
remove the warn statement, that is all I am going to do)
On a related subject I always used ICRF for my ftp releases. As Jack Shirazi
has mentioned in an earlier message that he cannot maintain that site anymore.
Could someone mention another site I could send my releases to
Regards,
Graham.
--%<--%<--%<--%<--%<--%<--%<--%<--%<--%<--%<--%<--%<--%<--%<--%<--%<--
diff -c -r ../MailTools-1.02a/lib/Mail/Util.pm lib/Mail/Util.pm
*** ../MailTools-1.02a/lib/Mail/Util.pm Mon Aug 14 13:37:11 1995
--- lib/Mail/Util.pm Tue Aug 22 07:13:49 1995
***************
*** 6,12 ****
package Mail::Util;
! sub Version { sprintf("%d.%02da", q$Revision: 1.1 $ =~ /(\d+)\.(\d+)/) }
require 5.000;
require AutoLoader;
--- 6,12 ----
package Mail::Util;
! sub Version { sprintf("%d.%02da", q$Revision: 1.3 $ =~ /(\d+)\.(\d+)/) }
require 5.000;
require AutoLoader;
***************
*** 16,22 ****
@ISA = qw(Exporter AutoLoader);
! @EXPORT_OK = qw(read_mbox maildomain);
1;
--- 16,22 ----
@ISA = qw(Exporter AutoLoader);
! @EXPORT_OK = qw(read_mbox maildomain mailaddress);
1;
***************
*** 51,58 ****
--- 51,84 ----
}
sub maildomain {
+
+ ##
+ ## return imediately if already found
+ ##
+
return $domain if(defined $domain);
+ ##
+ ## Try sendmail config file if exists
+ ##
+
+ local *CF;
+
+ if(open(CF,"/etc/sendmail.cf")) {
+ while(<CF>) {
+ if(/\ADF(\S+)/) {
+ $domain = $1;
+ last;
+ }
+ }
+ close(CF);
+ return $domain if(defined $domain);
+ }
+
+ ##
+ ## Try a SMTP connection to 'mailhost'
+ ##
+
if(eval "require Net::SMTP") {
my $smtp = Net::SMTP->new("mailhost");
***************
*** 65,76 ****
}
}
unless(defined $domain) {
! if(eval "require Sys::Domainname") {
! $domain = Sys::Domainname::domainname();
}
}
return $domain;
}
--- 91,133 ----
}
}
+ ##
+ ## Use internet domain name, if it can be found
+ ##
+
unless(defined $domain) {
! if(eval "require Sys::Domainname" && eval "require Sys::Hostname") {
! my $host = (split(/\./,Sys::Hostname::hostname()))[0];
!
! $domain = $host . "." . Sys::Domainname::domainname();
}
}
return $domain;
+ }
+
+ sub mailaddress {
+
+ ##
+ ## Return imediately if already found
+ ##
+
+ return $mailaddress if(defined $mailaddress);
+
+ ##
+ ## first look for $ENV{MAILADDRESS}
+ ##
+
+ return $mailaddress = $ENV{MAILADDRESS} if(defined $ENV{MAILADDRESS});
+
+ ##
+ ## Default to user name and maildomain
+ ##
+
+ maildomain() unless(defined $domain);
+
+ my $user = $ENV{USER} || $ENV{LOGNAME} || "";
+
+ $mailaddress = $user . "@" . $domain;
}
--%<--%<--%<--%<--%<--%<--%<--%<--%<--%<--%<--%<--%<--%<--%<--%<--%<--
--
.-----------------------------------------------------------.
//// | Graham Barr Email: bodg@tiuk.ti.com | \\\\
| 00 | VLSI Cell Designer or: bodg@ti.com | 00 |
O ^ | MOS Design TI MSG: BODG | ^ O
\ ~/ | Texas Instruments Ltd Phone: +44 (0)1604 66 3419 | \~ /
| ENGLAND Fax: +44 (0)1604 66 3456 |
`-----------------------------------------------------------'
On Sun, 20 Aug 1995 22:06:18 -0400 (EDT)
Kenneth Albanowski <kjahds@kjahds.com> writes:
>Grahm, I haven't received word from you yet, so I'm trying another
>message: perlbug has been converted over to MailUtils (and is much more
>strict, Tom) but Mail::Util::maildomain has a couple of glitches: first,
>if either SMTP lookup fails because of an invalid address (unable to
>resolve "localhost" or "mailhost" then you get a warning message on the
>screen, and secondly, if it falls back to Sys::Domainname, then it only
>returns a domain name, and not a host, unlike the SMTP mail domains,
>which include hosts.
Apply this patch in the MailTools-1.02a directory this should improve
maildomain. It now also looks in /etc/sendmail.cf if it exists before
calling smtp.
This patch will not fix the warnings from the Net::SMTP module (just
remove the warn statement, that is all I am going to do)
On a related subject I always used ICRF for my ftp releases. As Jack Shirazi
has mentioned in an earlier message that he cannot maintain that site anymore.
Could someone mention another site I could send my releases to
Regards,
Graham.
--%<--%<--%<--%<--%<--%<--%<--%<--%<--%<--%<--%<--%<--%<--%<--%<--%<--
diff -c -r ../MailTools-1.02a/lib/Mail/Util.pm lib/Mail/Util.pm
*** ../MailTools-1.02a/lib/Mail/Util.pm Mon Aug 14 13:37:11 1995
--- lib/Mail/Util.pm Tue Aug 22 07:13:49 1995
***************
*** 6,12 ****
package Mail::Util;
! sub Version { sprintf("%d.%02da", q$Revision: 1.1 $ =~ /(\d+)\.(\d+)/) }
require 5.000;
require AutoLoader;
--- 6,12 ----
package Mail::Util;
! sub Version { sprintf("%d.%02da", q$Revision: 1.3 $ =~ /(\d+)\.(\d+)/) }
require 5.000;
require AutoLoader;
***************
*** 16,22 ****
@ISA = qw(Exporter AutoLoader);
! @EXPORT_OK = qw(read_mbox maildomain);
1;
--- 16,22 ----
@ISA = qw(Exporter AutoLoader);
! @EXPORT_OK = qw(read_mbox maildomain mailaddress);
1;
***************
*** 51,58 ****
--- 51,84 ----
}
sub maildomain {
+
+ ##
+ ## return imediately if already found
+ ##
+
return $domain if(defined $domain);
+ ##
+ ## Try sendmail config file if exists
+ ##
+
+ local *CF;
+
+ if(open(CF,"/etc/sendmail.cf")) {
+ while(<CF>) {
+ if(/\ADF(\S+)/) {
+ $domain = $1;
+ last;
+ }
+ }
+ close(CF);
+ return $domain if(defined $domain);
+ }
+
+ ##
+ ## Try a SMTP connection to 'mailhost'
+ ##
+
if(eval "require Net::SMTP") {
my $smtp = Net::SMTP->new("mailhost");
***************
*** 65,76 ****
}
}
unless(defined $domain) {
! if(eval "require Sys::Domainname") {
! $domain = Sys::Domainname::domainname();
}
}
return $domain;
}
--- 91,133 ----
}
}
+ ##
+ ## Use internet domain name, if it can be found
+ ##
+
unless(defined $domain) {
! if(eval "require Sys::Domainname" && eval "require Sys::Hostname") {
! my $host = (split(/\./,Sys::Hostname::hostname()))[0];
!
! $domain = $host . "." . Sys::Domainname::domainname();
}
}
return $domain;
+ }
+
+ sub mailaddress {
+
+ ##
+ ## Return imediately if already found
+ ##
+
+ return $mailaddress if(defined $mailaddress);
+
+ ##
+ ## first look for $ENV{MAILADDRESS}
+ ##
+
+ return $mailaddress = $ENV{MAILADDRESS} if(defined $ENV{MAILADDRESS});
+
+ ##
+ ## Default to user name and maildomain
+ ##
+
+ maildomain() unless(defined $domain);
+
+ my $user = $ENV{USER} || $ENV{LOGNAME} || "";
+
+ $mailaddress = $user . "@" . $domain;
}
--%<--%<--%<--%<--%<--%<--%<--%<--%<--%<--%<--%<--%<--%<--%<--%<--%<--
--
.-----------------------------------------------------------.
//// | Graham Barr Email: bodg@tiuk.ti.com | \\\\
| 00 | VLSI Cell Designer or: bodg@ti.com | 00 |
O ^ | MOS Design TI MSG: BODG | ^ O
\ ~/ | Texas Instruments Ltd Phone: +44 (0)1604 66 3419 | \~ /
| ENGLAND Fax: +44 (0)1604 66 3456 |
`-----------------------------------------------------------'