am having problem with my send mail script. first it cant show progress when send starts. second cant send to multiple receipts

i appreciate for correction

#!/usr/bin/perl -w use CGI::Carp qw(fatalsToBrowser warningsToBrowser); use CGI; use MIME::Lite; use CGI::ProgressBar qw/:standard/; $| = 1; # Do not buffer output my $CGI = CGI->new(); my $from_email = $CGI->param("from_email"); my $from_name = $CGI->param("from_name"); my $subject = $CGI->param("subject"); my $receipts = $CGI->param("receipts"); my $message = $CGI->param("message"); # Newline format. send message to each email listed my $output = join "\n", split " ", $receipts; if ($from_email, $from_name, $subject, $receipts, $message) { my $msg = MIME::Lite->new( # From Name: John Deo And Sent From Email: johndeo@mail.com From => "$from_name <$from_email>", To => $output, Subject => $subject, Data => $message ); # Support HTML Message $msg->attr("content-type" => "text/html"); $msg->send; if ($msg) { # if mail starts sending print progress_bar( -from=>1, -to=>100 ); for (1..100){ print update_progress_bar; # Print ProgressBar $progressbar_html = qq{<div class="box"> <div id="progressbar"> <div></div> </div> <div class="text">Sending... 1%</div> </div> }; sleep 1; } print $response = "Message Sent Successfully"; exit; } if(!$msg) { print $response = "Message Failed To Send"; } } print "Content-type: text/html\n\n"; print <<START_HTML; <!DOCTYPE html> <html> <head> <title>Simple Mailer</title> <style type="text/css"> .box { border-radius: 10px; padding: 25px; background-color: rgba(51, 51, 51, 0.96); text-align: center; } #progressbar { border: 3px solid #fff; border-radius: 20px; padding: 2px; } #progressbar > div { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; background-color: #fff; width: 1%; height: 18px; border: 1px solid rgba(0, 0, 0, 0); border-radius: 20px; } .text { color: #fff; margin-top: 15px; font-size: 21px; font-weight: bold; } </style> </head> <body> <form method="post"> <label>From Email <input type="text" name="from_email" /> <br /> <br /> From Name <input type="text" name="from_name" /> </label> <p> <label>Subject <input type="text" name="subject" /> </label> </p> <p> <label>Receipts <textarea name="receipts"></textarea> </label> </p> <p> <label>message <textarea name="message"></textarea> </label> </p> <p> <label>Send <input type="submit" value="Submit" /> </label> </p> </form> <p>&nbsp;</p> $progressbar_html <p>$response</p> </body> </html> START_HTML

In reply to send mail by bigup401

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.