#!/usr/bin/perl # this script runs through the various bible verses daily # (incrementing number.txt) and mails em out. require '/usr/home/fso/libs/fso-g-lib.pl'; require '/usr/home/em/libs/em-defs.pl'; require '/usr/home/em/libs/em-g-lib.pl'; use rlib '../../../mod-lib'; use rlib '../../../../dntk/mod-lib'; use di; use dntk; my $dntk = new dntk; require HTML::Parse; require HTML::FormatText; #require HTML::TableExtract; use Date::Manip; use File::Copy; # TOP_DIR hack $TOP_DIR = "${TOP_DIR}/dr"; $lyris::config_filename = "/opt/lyris/cgi/lyris.plc"; my $rc = &lyris::init; $| = 1; $DEBUG = 1; $N_DATE = &UnixDate('today', '%m-%d-%Y'); #$N_DATE = "04-11-02"; #$AD_DATE = "2002-04-11"; $REPLYTO = "dr-text-reply\@DailyInbox.com"; $OURMAIL = "dr-text\@DailyInbox.com"; $BASE = "$SYSURL/daily"; $CONTENT = "$TOP_DIR/bank/content"; $LAST_MAILED_CONTENT = "last.mailed.dr.txt"; # name of file where last send is kept $CHECK_FOR_DUPS = 1; # set it to prevent a dup submission from going through $SUBJECT = "DailyInbox.com - Daily Reflections - $N_DATE"; open(LOG, ">>/opt/zing_send.log"); $date = `/usr/bin/date`; chomp($date); print LOG "\n-----------------------------\nStarting [bv_text.pl] $LIST send run - $date\n"; $SUBJECT = "DailyInBox.com - Daily Reflections - $N_DATE"; my $ad_text = ""; # TOP_DIR hack my $number = &getcount("$TOP_DIR/bank"); print OUT "-> Zing number: $number \n"; open (NUM, "< $TOP_DIR/bank/number.txt"); $number = ; chop($number); close NUM; open(IN, "<$CONTENT/${number}.txt") or die("EM - $LIST - couldn't open content file [$CONTENT/${number}.txt]"); @LINES = ; print LOG "-> Successfully retrieved [$CONTENT/${number}.html] content for send.\n"; $htmldata = HTML::Parse::parse_htmlfile("$CONTENT/${number}.txt"); $formatter = new HTML::FormatText(leftmargin => 4, rightmargin => 45); $textdata = $formatter->format($htmldata); #print "\n\n"; #print " " . $ad_text; #print "\n\n"; #exit; #$page .= " DailyInbox: Daily Reflections\n\n"; #$page .= " A free e-mail service from DailyInbox.com and Zing.com \n"; $page = "______________________________________________________ \n\n"; $page .= " Enjoy today's DAILY REFLECTION and consider sending\n"; $page .= " this enjoyable service to a friend or family\n"; $page .= " member. Brighten their day by giving them a FREE\n"; $page .= " subscription at:\n"; $page .= " http://Mailroom.DailyInbox.Com/dr/addFriend.iphtml\n"; $page .= "______________________________________________________ \n\n"; $page .= "###TARGET_2###\n"; $page .= " ______________________________________________________ \n\n"; $page .= "* You can view today's pictorial Daily Reflection here: \n\n"; $page .= " http://DailyInbox.com/dr/\n"; $page .= " for AOL users\n\n\n"; $page .= "* The quote from today's Daily Reflection is: \n\n"; $page .= " ${textdata}"; $page .= "\n\n"; $page .= " NOTE: To view the pictures you will need web access.\n\n"; $page .= " ______________________________________________________ \n\n"; $page .= " Subscribe a Friend: http://MailRoom.DailyInBox.com/dr/f.iphtml \n"; $page .= " You may unsubscribe here: http://DailyInBox.com/dr/unsubscribe.shtml\n"; $page .= " Visit our website: http://DailyInBox.com\n"; $page .= " You are subscribed with: \$subst('Recip.EmailAddr')\n"; $page .= " Mail your unsubscribe request to:\n\n"; $page .= " DailyInbox\n"; $page .= " P.O. Box 913\n"; $page .= " Wimberley, TX 78676\n\n"; $page .= " ______________________________________________________ \n\n"; ### AS my $ad_body = &insert_ads($page, $dntk, $AD_DATE, "dr-text"); my $page = $ad_body; #print $page; #exit; # now submit to lyris $mid = &sendLyrisMail("dr-text", "$SUBJECT", "$REPLYTO", "$OURMAIL", "$page", "txt", "$LIST.html"); #$mid = &sendLyrisMail("dr-test-text", "TEST - $SUBJECT", "$REPLYTO", "$OURMAIL", "$page", "txt", "$LIST.html"); print LOG "Message id: [$mid]\n"; if ( ! $mid ) { print LOG "ERROR: Message inject into lyris for $LIST has failed! [$mid]\n"; `/usr/local/bin/critsit "HTML $LIST [$mid] message into Lyris failed!"`; exit; } print LOG "Not incrementing number [$CURRENT]\n"; print LOG "Done.\n\n"; exit;