-
-
Save fvox/f7cecd4edc80e165b09b to your computer and use it in GitHub Desktop.
Send email with GMail
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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