use warnings; use strict; use Net::SMTP; my $smtp = Net::SMTP->new( 'smtp.gmail.com', Hello => 'local.example.com', Timeout => 30, Debug => 1, SSL => 1, Port => 465 ); # Password here is an app password. Need to enable 2FA on Google # account to generate one $smtp->auth('steve.bertrand@gmail.com', '*app_password*') or die; $smtp->mail('steve.bertrand@gmail.com'); $smtp->to('steve.bertrand@gmail.com'); $smtp->data(); $smtp->datasend("hey!\n"); $smtp->quit();