use strict; use warnings; use Email::Send; use Email::Send::Gmail; use MIME::Lite; my $msg = MIME::Lite->new( From =>'bob@gmail.com', To =>'bob@gmail.com', Subject =>'test' ); my $sender = Email::Send->new( { mailer => 'Gmail', mailer_args=>[ username=>'bob@gmail.com',password=>'123456',] } ); eval { $sender->send($msg) }; die "Error sending email: $@" if $@;