Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Test-Reporter CPAN distribution.

Report information
The Basics
Id: 8544
Status: resolved
Priority: 0/
Queue: Test-Reporter

People
Owner: RSOD [...] cpan.org
Requestors: MTHURN [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 1.20
Fixed in: (no value)



Subject: IMPROVEMENT for sending email via finicky ISPs
There are three reasons why Test::Reporter does not work for me. (Specifically, it does not work in its default configuration which is necessary for CPANPLUS to work.) The reasons are: 1) My ISP does not allow me to send email via some other MX server; 2) My ISP requires me to authenticate to send email; and 3) My ISP does not like the From: address that Test::Reporter chooses automatically for me. Attached is a patch that fixes all three. The new code looks for environment variables to trigger its work. Since RT doesn't let me attach more than one file, I will submit a POD patch separately.
*** Reporter.pm.orig Sun Nov 21 15:30:43 2004 --- Reporter.pm Sun Nov 21 15:32:23 2004 *************** *** 18,23 **** --- 18,24 ---- use Config; use Carp; use Net::SMTP; + use Net::SMTP_auth; use File::Temp; use Test::Reporter::Mail::Util; use Test::Reporter::Date::Format; *************** *** 340,346 **** warn __PACKAGE__, ": _send_smtp\n" if $self->debug(); my $helo = $self->_maildomain(); ! my $from = $self->from(); my $via = $self->via(); my $debug = $self->debug(); my @recipients = @_; --- 341,347 ---- warn __PACKAGE__, ": _send_smtp\n" if $self->debug(); my $helo = $self->_maildomain(); ! my $from = $ENV{SMTPFROM} || $self->from(); my $via = $self->via(); my $debug = $self->debug(); my @recipients = @_; *************** *** 365,384 **** } @recipients = @tmprecipients; ! for my $mx (@{$self->{_mx}}) { ! $smtp = Net::SMTP->new((@{$self->{_mx}})[0], Hello => $helo, ! Timeout => $self->{_timeout}, Debug => $debug); ! last if defined $smtp; $fail++; } - if ($fail == scalar @{$self->{_mx}}) { $self->errstr(__PACKAGE__ . ': Unable to connect to any MX\'s'); return 0; } ! $via = ', via ' . $via if $via; if (@recipients) { --- 366,395 ---- } @recipients = @tmprecipients; ! if ($ENV{SMTPSERVER} ne '') # added by Martin Thurn ! { ! unshift @{$self->{_mx}}, $ENV{SMTPSERVER}; ! } # if ! my $thurnMXused; for my $mx (@{$self->{_mx}}) { ! # print STDERR " DDD Test::Reporter::_send_smtp() trying MX ==$mx==\n"; ! $smtp = Net::SMTP_auth->new($mx, Hello => $helo, ! Timeout => $self->{_timeout}, ! Debug => $debug); ! $thurnMXused = $mx; last if defined $smtp; + $thurnMXused = 'none'; $fail++; } if ($fail == scalar @{$self->{_mx}}) { $self->errstr(__PACKAGE__ . ': Unable to connect to any MX\'s'); return 0; } ! if ($ENV{SMTPPASSWORD} ne '') # added by Martin Thurn ! { ! # print STDERR " DDD login to $thurnMXused as $ENV{SMTPUSERNAME}...\n"; ! $smtp->auth('LOGIN', $ENV{SMTPUSERNAME}, $ENV{SMTPPASSWORD}); ! } # if $via = ', via ' . $via if $via; if (@recipients) { *************** *** 386,391 **** --- 397,404 ---- chomp $recipients; chomp $recipients; } + local $" = ','; + # print STDERR " DDD trying to send email from $from to @recipients...\n"; $success += $smtp->mail($from); $success += $smtp->to($self->{_address}); *************** *** 404,418 **** $success += $smtp->quit; if (@recipients) { $self->errstr(__PACKAGE__ . ! ": Unable to send test report to one or more recipients\n") if $success != 14; } else { $self->errstr(__PACKAGE__ . ": Unable to send test report\n") if $success != 12; } - return $self->errstr() ? 0 : 1; ! } sub from { my $self = shift; --- 417,432 ---- $success += $smtp->quit; if (@recipients) { + local $" = ','; $self->errstr(__PACKAGE__ . ! ": Unable to send test report from $from to @recipients (success == $success)\n") if $success != 14; } else { + # print STDERR (" III in Test::Reporter::_send_report, MX is ==$thurnMXused==\n"); $self->errstr(__PACKAGE__ . ": Unable to send test report\n") if $success != 12; } return $self->errstr() ? 0 : 1; ! } # _send_smtp sub from { my $self = shift;
Subject: POD update for the "finicky ISPs" improvement
Attached is the patch for the POD explaining how my fixes for finicky ISPs work. (I also fixed a lot of typos in the POD, especially extraneous apostrophes.)
cd c:/SOURCE/perl/Test-Reporter-1.20/lib/Test/ diff -c "c:/SOURCE/perl/Test-Reporter-1.20/lib/Test/Reporter.pod.orig" "c:/SOURCE/perl/Test-Reporter-1.20/lib/Test/Reporter.pod" *** c:/SOURCE/perl/Test-Reporter-1.20/lib/Test/Reporter.pod.orig Wed Mar 5 02:02:34 2003 --- c:/SOURCE/perl/Test-Reporter-1.20/lib/Test/Reporter.pod Sun Nov 21 15:23:30 2004 *************** *** 40,46 **** Test::Reporter reports the test results of any given distribution to the CPAN testing service. See B<http://testers.cpan.org/> for details. ! Test::Reporter has wide support for various perl5's and platforms. =head1 METHODS --- 40,46 ---- Test::Reporter reports the test results of any given distribution to the CPAN testing service. See B<http://testers.cpan.org/> for details. ! Test::Reporter has wide support for various perl5s and platforms. =head1 METHODS *************** *** 117,122 **** --- 117,132 ---- is optional, as you may use Test::Reporter to only obtain the 'subject' and 'report' without sending an e-mail at all, although that would be unusual. + If your ISP does not allow you to send e-mail "anonymously" to the + perl.com MX server, set $ENV{SMTPSERVER} to your ISP's outgoing mail + server. + + If your ISP requires you to authenticate yourself to send e-mail, set + $ENV{SMTPUSERNAME} and $ENV{SMTPPASSWORD}. + + If your ISP does not like the From: address that Test::Reporter + automatically chooses for you, set $ENV{SMTPFROM} to one it allows. + =item * B<timeout> Optional. Gets or sets the timeout value for the submission of test *************** *** 140,157 **** Optional. Gets or sets the e-mail address that the reports will be sent to. By default, this is set to cpan-testers@perl.org. You shouldn't ! need this unless the CPAN Tester's change the e-mail address to send ! report's to. =item * B<mx> Optional. Gets or sets the mail exchangers that will be used to send the test reports. If you override the default values make sure you ! pass in a reference to an array. By default, this contains the MX's known at the time of release for perl.org. If you do not have Mail::Send installed (thus using the Net::SMTP interface) and do have ! Net::DNS installed it will dynamically retrieve the latest MX's. You ! really shouldn't need to use this unless the hardcoded MX's have become wrong and you don't have Net::DNS installed. =item * B<mail_send_args> --- 150,167 ---- Optional. Gets or sets the e-mail address that the reports will be sent to. By default, this is set to cpan-testers@perl.org. You shouldn't ! need this unless the CPAN Testers change the e-mail address to send ! reports to. =item * B<mx> Optional. Gets or sets the mail exchangers that will be used to send the test reports. If you override the default values make sure you ! pass in a reference to an array. By default, this contains the MXes known at the time of release for perl.org. If you do not have Mail::Send installed (thus using the Net::SMTP interface) and do have ! Net::DNS installed it will dynamically retrieve the latest MXes. You ! really shouldn't need to use this unless the hardcoded MXes have become wrong and you don't have Net::DNS installed. =item * B<mail_send_args> *************** *** 197,203 **** If you specify recipients to be cc'd while using send() (and you do not have Mail::Send installed) be sure that you use the author's @cpan.org address ! otherwise they may not be delivered, since the perl.org MX's are unlikely to relay for anything other than perl.org and cpan.org. =head1 BUGS --- 207,213 ---- If you specify recipients to be cc'd while using send() (and you do not have Mail::Send installed) be sure that you use the author's @cpan.org address ! otherwise they may not be delivered, since the perl.org MXes are unlikely to relay for anything other than perl.org and cpan.org. =head1 BUGS *************** *** 239,245 **** This is optional. If it's installed Test::Reporter will dynamically retrieve the mail exchangers for perl.org, instead of relying on the ! MX's known at the time of this release. =item * L<Mail::Send> --- 249,255 ---- This is optional. If it's installed Test::Reporter will dynamically retrieve the mail exchangers for perl.org, instead of relying on the ! MXes known at the time of this release. =item * L<Mail::Send> Diff finished at Sun Nov 21 15:24:01
From: Richard Soderberg
[MTHURN - Sun Nov 21 15:38:29 2004]: Show quoted text
> There are three reasons why Test::Reporter does not work for me. > (Specifically, it does not work in its default configuration which > is necessary for CPANPLUS to work.) The reasons are: 1) My ISP > does not allow me to send email via some other MX server; 2) My ISP > requires me to authenticate to send email; and 3) My ISP does not > like the From: address that Test::Reporter chooses automatically > for me. Attached is a patch that fixes all three. The new code > looks for environment variables to trigger its work. Since RT > doesn't let me attach more than one file, I will submit a POD patch > separately.
Thanks for the patch; does the MAILADDRESS environment variable not work properly? The code seems to support setting the From address from it, and I'd rather not add a *second* environment variable for the same thing. I'll look into integrated Net::SMTP_auth properly, so that it's an optional module, as its dependencies require a C compiler. Test::Reporter objects already appear to support the ->mx(\@hostnames) method, which allows you to modify the MXs it will try and contact before sending. Does this not work properly? - R.
I merged the POD ticket (#8545) into #8544; thanks for submitting both patches. [mthurn@verizon.net - Mon Dec 27 21:46:05 2004]: Show quoted text
> > Full context and any attached attachments can be found at: > > <URL: http://rt.cpan.org/NoAuth/Bug.html?id=8544 > > > > > [MTHURN - Sun Nov 21 15:38:29 2004]:
Show quoted text
> Well the point of all this is that I am not writing my own code, I > am just trying to get an existing application (e.g. cpanp) to work > without having to modify its source code.
I'll patch Test::Reporter to handle the environment variables here shortly; it's easier, and doesn't do any harm to support for now. I'll also try to patch CPANPLUS's initial setup routines to support a user-provided MX server(s) with auth information, at some point. Have you had any trouble with Net::SMTP_auth? Thanks for the suggestions! - R.