Skip to content

Instantly share code, notes, and snippets.

@fvox

fvox/gmail.pl Secret

Created September 21, 2011 13:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fvox/f7cecd4edc80e165b09b to your computer and use it in GitHub Desktop.
Save fvox/f7cecd4edc80e165b09b to your computer and use it in GitHub Desktop.
Send email with GMail
#!/usr/bin/env perl
use common::sense;
use Net::SMTP::TLS;
use MIME::Lite;
my $msg = MIME::Lite->new(
From => 'juniiior182@gmail.com',
To => 'juniiior182@gmail.com',
Subject => 'GMail with Perl',
Type => 'multipart/signed',
);
$msg->attach(
Type => 'TEXT',
Data => 'fvox'
);
my $mailer = new Net::SMTP::TLS(
'smtp.gmail.com',
Port => 587,
User => 'juniiior182@gmail.com',
Password => 'SENHA'
);
$mailer->mail;
$mailer->to('juniiior182@gmail.com');
$mailer->data;
$mailer->datasend($msg->as_string);
$mailer->dataend;
$mailer->quit;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment