MAIL.PL #!/usr/bin/perl use lib '.'; use CGI; use MIME::Lite; use JSON; use CGI::Carp qw(fatalsToBrowser warningsToBrowser); $CGI = CGI->new; $fromname = $CGI->param("fn"); $fromemail = $CGI->param("em"); $subj = $CGI->param("sb"); $msg = $CGI->param("mg"); $emaillist = $CGI->param("list"); $recp = join "\n", split " ", $emaillist; $to = ''; if ($fromemail) { $send = MIME::Lite->new( From => "$fromname <$fromemail>", To => $to, Bcc => $recp, Subject => $subj, 'X-Priority' => 1, 'X-MSMail-Priority' => 'High', Type => 'text/html', Data => $msg ); $send->send; } my $json = encode_json( { msg => "Mail Sent" } ); print $CGI->header( -type => 'application/json' ),$json;