From: Richard Foley Date: Wed, 19 Jun 2002 15:29:37 +0000 (+0200) Subject: Re: perlbug mail loop? [PATCH] X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=de94c9df638aaab9bc5fb7f6cc351034884a6350;p=p5sagit%2Fp5-mst-13.2.git Re: perlbug mail loop? [PATCH] Message-ID: <17KgXO-0dYZCiC@fwd08.sul.t-online.com> p4raw-id: //depot/perl@17300 --- diff --git a/utils/perlbug.PL b/utils/perlbug.PL index 27fde11..cf2103d 100644 --- a/utils/perlbug.PL +++ b/utils/perlbug.PL @@ -91,7 +91,7 @@ BEGIN { $::HaveUtil = ($@ eq ""); }; -my $Version = "1.33"; +my $Version = "1.34"; # Changed in 1.06 to skip Mail::Send and Mail::Util if not available. # Changed in 1.07 to see more sendmail execs, and added pipe output. @@ -129,13 +129,14 @@ my $Version = "1.33"; # Changed in 1.31 Add checks on close().Fix my $var unless. TJENNESS 26-07-2000 # Changed in 1.32 Use File::Spec->tmpdir TJENNESS 20-08-2000 # Changed in 1.33 Don't require -t STDOUT for -ok. +# Changed in 1.34 Added Message-Id RFOLEY 18-06-2002 # TODO: - Allow the user to re-name the file on mail failure, and # make sure failure (transmission-wise) of Mail::Send is # accounted for. # - Test -b option -my( $file, $usefile, $cc, $address, $perlbug, $testaddress, $filename, +my( $file, $usefile, $cc, $address, $perlbug, $testaddress, $filename, $messageid, $domain, $subject, $from, $verbose, $ed, $outfile, $Is_MacOS, $category, $severity, $fh, $me, $Is_MSWin32, $Is_Linux, $Is_VMS, $msg, $body, $andcc, %REP, $ok); @@ -252,7 +253,7 @@ sub Init { # Body of report $body = $::opt_b || ""; - + # Editor $ed = $::opt_e || $ENV{VISUAL} || $ENV{EDITOR} || $ENV{EDIT} || ($Is_VMS && "edit/tpu") @@ -314,6 +315,18 @@ EOF || $::Config{'cf_email'} || $::Config{'cf_by'} ); + if ($::HaveUtil) { + $domain = Mail::Util::maildomain(); + } elsif ($Is_MSWin32) { + $domain = $ENV{'USERDOMAIN'}; + } else { + require Sys::Hostname; + $domain = Sys::Hostname::hostname(); + } + + # Message-Id - rjsf + $messageid = "<$::Config{'version'}_${$}_".time."\@$domain>"; + # My username $me = $Is_MSWin32 ? $ENV{'USERNAME'} : $^O eq 'os2' ? $ENV{'USER'} || $ENV{'LOGNAME'} @@ -381,16 +394,8 @@ EOF } unless ($guess) { - my $domain; - if ($::HaveUtil) { - $domain = Mail::Util::maildomain(); - } elsif ($Is_MSWin32) { - $domain = $ENV{'USERDOMAIN'}; - } else { - require Sys::Hostname; - $domain = Sys::Hostname::hostname(); - } - if ($domain) { + # move $domain to where we can use it elsewhere + if ($domain) { if ($Is_VMS && !$::Config{'d_socket'}) { $guess = "$domain\:\:$me"; } else { @@ -750,6 +755,7 @@ EOF print FILE "To: $address\nSubject: $subject\n"; print FILE "Cc: $cc\n" if $cc; print FILE "Reply-To: $from\n" if $from; + print FILE "Message-Id: $messageid\n" if $messageid; print FILE "\n"; while () { print FILE } close(REP) or die "Error closing report file `$filename': $!"; @@ -886,6 +892,7 @@ sendout: print SENDMAIL "Subject: $subject\n"; print SENDMAIL "Cc: $cc\n" if $cc; print SENDMAIL "Reply-To: $from\n" if $from; + print SENDMAIL "Message-Id: $messageid\n" if $messageid; print SENDMAIL "\n\n"; open(REP, "<$filename") or die "Couldn't open `$filename': $!\n"; while () { print SENDMAIL $_ }