[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Script per invio attachment



Devi usare il modulo MIME::Lite:


sub SendAttachment()
 # ---------------------------------
 # invia e-mail con allegati
 # --------------------------------
 {
 use MIME::Lite;
 my $msg="";


 if (!($msg=MIME::Lite->new(
 	From => 'MyServer <myself@mio.dominio.org>',
	To => pippo@vattelappesca.it,
	Subject => 'Oggetto della mail',
	Type=> 'TEXT',
	Data=> 'Testo dela messaggio...'))) {
		print( "Can't initialize MIME!\n");
		return FALSE;
		}
		
 if (!($msg->attach(
 	Type=> 'application/pdf',
	Path=>$DIR."/mioattachment.pdf",
	Filename=> $filename.".pdf"))) {
		print( "Can't attach file on mail!\n");
		return FALSE;
		}
		
$msg->send;

return $OK;
 }



Reply to: