Skip to content

Instantly share code, notes, and snippets.

@hc0d3r

hc0d3r/smtp.pl Secret

Created August 31, 2013 23:18
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 hc0d3r/cafcfc7f3c8c09be97f9 to your computer and use it in GitHub Desktop.
Save hc0d3r/cafcfc7f3c8c09be97f9 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl -w
# Enviador Gmail by MMxM , versao beta 0.0 -_-
use strict;
use Net::SMTP::TLS;
die("$0 <user> <pass> <emails> <engenharia> <assunto>") if(@ARGV != 5);
my($user,$pass,$email,$eng,$assunto) = @ARGV;
my $smtp = new Net::SMTP::TLS(
'smtp.gmail.com',
Port => 587,
User => $user,
Password=> $pass,
Timeout => 30
) || die($!);
open(EMAILS,'<'.$email) || die($!);
my @emails = <EMAILS>;
close(EMAILS);
open(ENG,'<'.$eng) || die($!);
my @e = <ENG>;
my $en = join('',@e);
close(ENG);
foreach(@emails){
chomp($_);
$smtp->mail($user);
$smtp->recipient($_);
$smtp->data();
$smtp->datasend("To: $_\n");
$smtp->datasend("From: Nome de quem mandou <$user>\n"); ### mude isso ae '-'
$smtp->datasend("Content-Type: text/html \n");
$smtp->datasend("Subject: $assunto");
$smtp->datasend("\n");
$smtp->datasend("$en");
$smtp->datasend("\n");
$smtp->dataend();
print "Enviado para $_\n";
}
$smtp->quit;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment