How attach files and send mails on perl????

[email protected] ("Armin Garcia")
Newsgroups perl.beginners
Message-ID <[email protected]>
Hi !!!!
Well i try to attach a file, but i dont know what function or method i need
to use, here is my code, i hope anybody can help me .... thanks
(im only want to attach files, thanlks )


#!/usr/bin/perl

use Mail::Internet;
use Mail::Box::Manager;
use Email::Folder;

$folder_file = "/home/agarcia/HoneyClient/Mbox-Folder/posible_spam";
$salida =
"/usr/local/Honeyclient/HoneyClient3/ScriptHoney/capture-server-2.1.0-300/Urls-Malware/filtrar.txt";
$UrlsFiltrar =
"/usr/local/Honeyclient/HoneyClient3/ScriptHoney/capture-server-2.1.0-300/Urls-Malware/Urls-Malware.txt";

# Abrimos el buzón.
my $mgr = Mail::Box::Manager->new;
$i=0;

$folder = Email::Folder->new($folder_file);
@urls = ();
$dir;
%Urls=();
if ( -e $salida ){
`rm -rf $salida`;
}

sub Parser {

open (F,"< $salida") || die "No se pudo abrir el archivo";
        @urls=<F>;
$i=0;
open (G, "> $UrlsFiltrar") || die "No se pudo crear";
foreach (@urls){
@aux=split(" ",@urls);
$URLS{$urls[$i]}++;
                $i++;
     }
        foreach $var(keys %URLS){
            print G "$var";
        }
        close(F);
        close(G);
}

sub EnviarCorreo {
$repfrom = shift(@_);
$arch = shift (@_);
$correos="agarcia\@server1.com.mx";

open(DATOS,$UrlsFiltrar);
@body = <DATOS>;
close(DATOS);

open(MAIL, "| /usr/sbin/sendmail $correos");
print MAIL "From: agarcia\@localhost\n";
print MAIL "To: agarcia\@server1.com.mx\n";
print MAIL "Subject: test !!!!!\n\n";
print MAIL @body;
close(MAIL);
}

for ($folder->messages) {
 for ( $_->body ) {
if ( $_ =~ /http:/ ) {
@urls = /(((ftp|http|https):\/\/|www\.)([\w*\-?\w*\.]+)*)/g;
}
}

open (F," >> $salida") || die "No se puede crear el archivo ...";
foreach my $url (@urls) {
print F "$url\n";
}
 close(F);
}

Parser;
EnviarCorreo($salida);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.