"(perl net::smtp) authentication failure using gmail smtp server" Code Answer

5
use net::smtp;
my $smtp = net::smtp->new ....

afaik you need to use an encrypted connection to send via gmail, use net::smtp::tls or net::smtp::ssl (with port 465)

hello=>'user@gmail.com'

'hello' is not an email address, put your hostname there instead

$sender = "user@gmail.com";
...
$receiver = "user@gmail.com";

put these in single quotes

if you still get "could not authenticate." make sure you have the modules mime::base64 and authen::sasl installed.

 $smtp->datasend("to: <$reciever> n");

should be $receiver, not $reciever

By Pascal Charbonneau on January 31 2022

Answers related to “(perl net::smtp) authentication failure using gmail smtp server”

Only authorized users can answer the Search term. Please sign in first, or register a free account.