Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/local/bin/perl
- $ARGC=@ARGV;
- if ($ARGC !=4) {
- printf "Você digitou de uma forma errada. Siga as instruções.n";
- printf "INSTRUÇÕES - UND3F1N3Dn";
- printf "perl $0 <mailist> <remetente@mail.com> <assunto> <corpo.html>n";
- printf "Exemplo: perl $0 lista01.txt peu@msn.com Ola index.htmln";
- exit(1);
- }
- $mailtype = "content-type: text/html";
- $sendmail = '/usr/sbin/sendmail';
- $sender = $ARGV[1];
- $subject = $ARGV[2];
- $efile = $ARGV[0];
- $emar = $ARGV[0];
- open(FOO, $ARGV[3]);
- @foo = <FOO>;
- $corpo = join("n", @foo);
- open (BANDFIT, "$emar") || die "Can't Open $emar";
- $cont=0;
- while(<BANDFIT>) {
- ($ID,$options) = split(/|/,$_);
- chop($options);
- foreach ($ID) {
- $recipient = $ID;
- open (SENDMAIL, "| $sendmail -t");
- print SENDMAIL "$mailtypen";
- print SENDMAIL "Subject: $subjectn";
- print SENDMAIL "From: $sendern";
- print SENDMAIL "To: $recipientnn";
- print SENDMAIL "$corponn";
- close (SENDMAIL);
- $cont=$cont+1;
- printf "$cont Enviado para $recipient";
- }
- }
- close(BANDFIT);
- $tar xvfz MIME-Lite-3.01.tar.gz
- $cd MIME-Lite-3.01
- $perl Makefile.PL
- $make
- $make install
- #!/usr/bin/perl
- use MIME::Lite;
- $to = 'abcd@gmail.com';
- $cc = 'efgh@mail.com';
- $from = 'webmaster@yourdomain.com';
- $subject = 'Test Email';
- $message = 'This is test email sent by Perl Script';
- $msg = MIME::Lite->new(
- From => $from,
- To => $to,
- Cc => $cc,
- Subject => $subject,
- Type => 'multipart/mixed'
- );
- # Add your text message.
- $msg->attach(Type => 'text',
- Data => $message
- );
- # Specify your file as attachement.
- $msg->attach(Type => 'image/gif', #Mimetype do arquivo
- Path => '/tmp/logo.gif', #Pasta do arquivo
- Filename => 'logo.gif', #Nome do arquivo
- Disposition => 'attachment'
- );
- $msg->send;
- print "Email enviado com sucesson";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement