Ugh!! I'm sure this is easy for most of you....but....

Having problems adding add'l email addresses to Web Secretary(not supporting any longer). Is anyone familiar with the product, and/or able to give advice? By default, the email is taken from an external flat file. Would like to bypass that and enter them dynamically.

Can I do someting similar to adding the sub routine inside the while loop below?

use DBI; my ($dsn) = "DBI:mysql:cpc:localhost"; # data source name my ($user_name) = ""; # user name my ($password) = ""; # password my ($dbh, $sth); # database and statement handles my (@ary); # array for rows returned by query # connect to database $dbh = DBI->connect ($dsn, $user_name, $password, { RaiseError => 1 }) +; # issue query my $query = qq{ SELECT email FROM auth_users}; $sth = $dbh->prepare ( $query ); $sth->execute (); # read results of query, then clean up while (@ary = $sth->fetchrow_array ()) {
#this a subroutine from Web Sec, listed below
&HandleSite();
} $sth->finish (); $dbh->disconnect (); #####parts of sub HandleSite from Web Sec###### sub HandleSite() { # Get parameter values for this page $url = $siteinfo{URL}; $auth = $siteinfo{Auth}; $name = $siteinfo{Name}; $prefix = $siteinfo{Prefix}; $diff = $siteinfo{Diff}; $hicolor = $siteinfo{Hicolor}; $ignore = $siteinfo{Ignore}; $ignoreurl = $siteinfo{IgnoreURL}; $email = $siteinfo{Email}; $emailLink = $siteinfo{EmailLink}; $proxy = $siteinfo{Proxy}; $proxyAuth = $siteinfo{ProxyAuth}; $tmin = $siteinfo{Tmin}; $tmax = $siteinfo{Tmax}; $digest = $siteinfo{Digest}; # If block without URL, assume parameter setting block and update defa +ult values if ($url eq "") { %defaults = %siteinfo; return 0; } # If essential parameters are not present, abort with error if ($name eq "" || $prefix eq "" || ($email eq "" && $emailLink eq "") +) { print "Name, prefix or email info missing from URL: $url.\n"; return -1; } # If URL is successfully downloaded if ($resp->is_success) { open (HTML_FILE, ">$page_current"); print HTML_FILE "<!-- X-URL: ", $resp->base, " -->\n"; print HTML_FILE "<BASE HREF= \"", $resp->base. "\">\n"; print HTML_FILE $resp->content; close HTML_FILE; if ($diff eq "webdiff") { if ($page_previousExists == 1) { print "Highlighting differences from previous version of webpage ...\n +"; $rc = system($webdiff); if ($rc != 0) { print "Sending highlighted page to $email ...\n"; if ($email ne "") { MailDocument($outgoing, $subj, $email); } if ($emailLink ne "") { if (($digest ne "no") && ($digest ne "false")) { push @digest,$url; ($digestEmail) or ($digestEmail=$emailLink); } else { $linkmsg = "The contents of the following URL has changed:\n\n$url\n"; MailMessage($linkmsg, $subj, $emailLink); } } } else { print "No changes were detected.\n"; } rename $page_previous, $page_archive; rename $page_current, $page_previous; } else { print "No previous version for this page. Storing in archive ...\n"; rename $page_current, $page_previous; } } else { if ($email ne "") { MailDocument($page_current, $subj, $email); } if ($page_previousExists) { rename $page_previous, $page_archive; } rename $page_current, $page_previous; } } # Mail message # Params: message, subject, recipient # Returns: none sub MailMessage() { my $message = shift(@_); my $subject = shift(@_); my @recipients = split/,/, shift(@_); foreach $email (@recipients) { $req = HTTP::Request->new(POST => "mailto:" . $email); $req->header("Subject", $subject); $req->header("Content-type", "text/plain; charset=us-ascii"); $req->header("Content-Transfer-Encoding", "7bit"); $req->header("MIME-Version", "1.0"); $req->content($message); $ua = new LWP::UserAgent; $ua->request($req); } } # Mail HTML document. # Params: filename, subject, recipient # Returns: none sub MailDocument() { my $filename = shift(@_); my $subject = shift(@_); my @recipients = split/,/, shift(@_); my $tmpstr = $/; undef $/; open(FILE, "$filename") or die "Cannot open $filename: $!\n"; my $content = <FILE>; close(FILE); foreach $email (@recipients) { $req = HTTP::Request->new(POST => "mailto:" . $email); $req->header("Subject", $subject); $req->header("Content-type", "text/html"); $req->header("Content-Transfer-Encoding", "7bit"); $req->header("MIME-Version", "1.0"); $req->content($content); $ua = new LWP::UserAgent; $ua->request($req); } $/ = $tmpstr; }

In reply to add emails from mySQL? by Anonymous Monk

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.