i have fixed my script and working very well now. without any help from anyone. i just went through each sub function to make sure each works

wat was confusing me is that. i thought i can just call only 1 function and leave others behind and run themselves on script execution

Now my mine point is to work on this script efficacy and effective to deliver msg to over 100k receivers

Anyone want to addone something, so it become more effective on delivering msg to 100k, i appreciate

#!/usr/bin/perl -wT use lib '.'; use warnings; use DBI; use Email::Sender::Simple qw(sendmail); use Email::Sender::Transport::SMTP (); use Email::Simple (); use Email::Simple::Creator (); use CGI qw/:standard/; use CGI::Carp qw(fatalsToBrowser warningsToBrowser); $CGI::DISABLE_UPLOADS = 1; $CGI::POST_MAX = 1048576; print "Content-type: text/html\n\n"; my $host = "xxxxx"; my $usr = "xxxxx"; my $pwd = "xxxxx"; my $dbname = "xxxxx"; my $dbh = DBI->connect("DBI:mysql:$dbname:$host", $usr, $pwd, { RaiseError => 1, }) or die $DBI::errstr; sub getusers { my $sth = $dbh->prepare("SELECT * FROM bmop"); $sth->execute(); while (my @row = $sth->fetchrow_array) { $name = $row[2]; # Get their names $rcpt = $row[5]; # Get their emails push @names,$name; push @rcpts,$rcpt; } } getusers(); sub getready { my $j = 0; foreach my $i(@names){ ## Grab user info from the table $rcv_names = $names[$j]; # Get their name $rcv_emails = $rcpts[$j]; # Get their email mail(); $j++; } } getready(); sub mail { my $sub = "Test mail"; my $msg = "<p> Hi $rcv_names </p>"; my $smtpserver = 'xxxx'; my $smtpport = 587; my $smtpuser = 'xxxxx'; my $smtppassword = 'x+x+x+'; my $transport = Email::Sender::Transport::SMTP->new({ host => $smtpserver, ssl => 'starttls', port => $smtpport, sasl_username => $smtpuser, sasl_password => $smtppassword, }); my $email = Email::Simple->create( header => [ To => $rcv_emails, From => 'xxxxx@xxxxx.com', Subject => $sub, 'Content-Type' => 'text/html', ], body => $msg, ); sendmail($email, { transport => $transport }); }

In reply to Re^2: mail with users names by frank1
in thread mail with users names by frank1

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.