Reputation: 1529
I have several hundred Perl scripts that send email via gmail SMTP. All are, and have been working fine for a couple of years with the gmail password hard-coded.
To simplify password changes (and for security), I want to move the password to an env var, and pull that into the perl scripts. I am using the code below.
my $smtp = Net::SMTP::SSL->new('smtp.gmail.com', Port => 465);
my $passwd = $ENV{'PASSWD'}; # I added this line
$smtp->auth('[email protected]', $passwd); # I replaced 'theHardCodedPassWord' with $passwd
The same method works in a non-smtp scenario -- I pull info from an env var and use it.
What am I doing wrong?
Upvotes: 0
Views: 122
Reputation: 69314
Two obvious debugging approaches:
$ENV{PASSWD}
and $passwd
before the call to auth()
.Debug => 1
to the call to new()
).A few other points:
Upvotes: 1