in reply to SMTP "auth" problem after upgrade

You may have to use Net::SMTP;
#!/usr/bin/perl use strict; use warnings; use MIME::Lite; use Net::SMTP; my $host = 'host'; my $user = 'user'; my $pass = 'pass'; unless (defined 'NoAuth') { my $smtp = MIME::Lite->send( 'smtp', $host, AuthUser => $user, AuthPass => $pass, Debug => 1 ); } else { my $smtp = MIME::Lite->send( 'smtp', $host, NoAuth => 1, Debug => 1 ); }

Replies are listed 'Best First'.
Re^2: SMTP "auth" problem after upgrade
by anonymized user 468275 (Curate) on May 13, 2011 at 16:05 UTC
    Apart from the fact that $smtp is scoped out of existence and Noauth being tested for defined looks like a tautology in this snippet, I would be inclined to factorise out the "unless" in such a situation where most of the lines of code in the two branches are identical, and use a tertiary operator instead :
    my $smtp = MIME::Lite->send('smtp', $host, defined( $something_else ) ? AuthUser => $user, AuthPass => $pass : Noauth => 1, Debug => 1 );

    One world, one people