use Net::SMTP; my $ServerName = "smtp.google.com" ; my $smtp = Net::SMTP->new($ServerName, port=> 587, Debug => 1) ; die "Couldn't connect to server" unless $smtp ; my $MailFrom = "sender\@gmail.com" ; my $MailTo = "receiver\@received.com" ; $smtp->mail( $MailFrom ) ; $smtp->to( $MailTo ) ; $smtp->data() ; $smtp->datasend("Hello World!\n\n") ; $smtp->dataend() ; $smtp->quit() ;