Sending Mail Through Gmail with Perl

We talked about some of the benefits of setting up an email server in Linux and how you can use python to send email. Now we are going to look at how you can send email from Perl.

The Code

use Net::SMTP::TLS;
my $mailer = new Net::SMTP::TLS(
    Hello   =>      '',
    Port    =>      587,
    User    =>      'username',
    Password=>      'password');
$mailer->datasend("Sent from perl!");