Code :
#!/usr/bin/perl -w use warnings; use strict; use MIME::Lite; use MIME::LITE::HTML; use MIME::Base64; use Authen::SASL; # set up email my $To = "toto\@yahoo.fr"; my $From = "Graph <toto\@gmail.com>"; my $Cc = ""; my $Bcc = ""; my $Subject = "[Graph]"; my $Top = "<span style=\"font-size:10pt;font-family:Verdana\"><font color=\"#000080\">Bonjour,<BR><BR>PI,<BR><BR></font></span>"; my $URL = "http://localhost:6569/graph/graph_image.php?local_graph_id=2445&rra_id=0&view_type=tree"; my $Graph = "<BR><img src=\"$URL\"><P>"; my $HTML = "<span style=\"font-size:10pt;font-family:Verdana\"><font color=\"#000080\"><BR><BR>Cordialement.<BR></font></span>"; # send email email($To, $From, $Cc, $Bcc, $Subject); # email function sub email { # get incoming parameters my ($To, $From, $Cc, $Bcc, $Subject) = @_; # create a new message my $msg = MIME::Lite->new( From => $From, To => $To, Cc => $Cc, Bcc => $Bcc, Subject => $Subject, Type => 'multipart/related', Data => $Top . $Graph . $HTML ) or die "Error creating multipart container: $!\n"; # send the email MIME::Lite->send('smtp', 'smtp.numericable.com', HELLO=>'smtp.numericable.com', PORT=>'25', Debug => 0, Timeout => 60); $msg->attr("content-type" => "text/html; charset=iso-8859-1" ); $msg->send(); print "***** $Subject *****\n"; } __END__
|