RSS Amplifier

Recent Content on nixtutor.com · Jul 6, 2009

Sending Mail Through Gmail with Perl

0
Sign in to vote or save

This page cannot be shown here. You can still read it on the original site — the toolbar below keeps your place in the directory.

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( 'smtp.gmail.com', Hello => 'smtp.gmail.com', Port => 587, User => 'username', Password=> 'password'); $mailer->mail('from@domain.com');…

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(
    'smtp.gmail.com',
    Hello   =>      'smtp.gmail.com',
    Port    =>      587,
    User    =>      'username',
    Password=>      'password');
$mailer->mail('from@domain.com');
$mailer->to('to@domain.com');
$mailer->data;
$mailer->datasend("Sent from perl!");
$mailer->dataend;
$mailer->quit;

Read on /linux/sending-mail-through-gmail-with-perl/

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.