use strict; use warnings; use MIME::Lite; use CGI; my $cgi = new CGI; MIME::Lite->send('smtp', '192.168.11.203', Timeout=>60); my $to = $cgi->param("to"); my $from = $cgi->param("from"); my $subject = $cgi->param("subject"); my $text = $cgi->param("text"); my @files = ($cgi->param("files")); my $msg = MIME::Lite->new( To => $to, From => $from, Subject => $subject, Type => 'multipart/mixed', ); $msg->attach(Type => 'TEXT', Data => $text ); for my $file (@files) { $msg->attach(Id => $file, Path => $file ); } $msg->send; ### will now use Net::SMTP as shown above