#!/usr/local/bin/perl 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'; require '/usr/home/fso/libs/cs-lib.pl'; use Date::Manip; use File::Copy; use rlib '../../../mod-lib'; use di; my $dntk = new dntk; $lyris::config_filename = "/usr/home/di/lyris/lyris.plc.postoffice2"; my $rc = &lyris::init; $| = 1; $DEBUG = 1; $bbody = ''; $AD_DATE = &UnixDate('today', '%Y-%m-%d'); #$AD_DATE = "2002-04-03"; $N_DATE = &UnixDate('today', '%m-%d-%Y'); #$N_DATE = "04-03-02"; # for ad tag... $number = &UnixDate('today', '%m%d%y') . "mfm"; #$number = "040302mfm"; # TOP_DIR hack $TOP_DIR = "$TOP_DIR/mm"; $LIST = "mm-w-html"; $CONTENT = "$TOP_DIR/bank/content"; $REPLYTO = "mm-w-html-reply\@DailyInbox.com"; $OURMAIL = "mm-w-html\@DailyInbox.com"; $SUBJECT = "DailyInbox.com - MM - $N_DATE"; open (OUT, ">> /opt/mm_send.log"); print OUT "-> -------------------------------------------------\n"; print OUT "-> Starting: " . &UnixDate('today', "%Y-%m-%d %H:%M:%S") . "\n"; print "Number: $CONTENT/${number}.html \n"; if ( ! -f "$CONTENT/${number}.html" ) { my @ARR; print "-> ERROR: cannot find [$CONTENT/${number}.html] content for send.\n"; push(@ARR, "-> ERROR: cannot find [$CONTENT/${number}.html] content for send.\n"); $dntk->smtp->setFromEmail('info@DailyInbox.com'); $dntk->smtp->setFromName('DIB MM - Content Checker'); $dntk->smtp->setToName('JimBo'); $dntk->smtp->setToEmail('oquinn@fsonline.com'); $dntk->smtp->setSubject("Cannot find MM-HTML file"); $dntk->smtp->setBody(\@ARR); $dntk->smtp->send('sendmail'); exit; } else { open (DAILY, "< $CONTENT/${number}.html" ); while () { if ( $_ =~ /<\/BODY>/ || $_ =~ /<\/body>/ ) { open (STOP, "< $TOP_DIR/subinfo.txt"); @slurp = ; close (STOP); foreach $what (@slurp) { $bbody .= $what; } } else { $bbody .= $_; } } close DAILY; } my $ad_body = &insert_ads($bbody, $dntk, $AD_DATE); my $bbody = $ad_body; copy ("$CONTENT/${number}.html", "$CONTENT/index.shtml"); $mid = &sendLyrisMail("mm-w-html", "$SUBJECT", "$REPLYTO", "$OURMAIL", "$bbody", "html", "$LIST.html"); #$mid = &sendLyrisMail("mm-html-test", "TEST - $SUBJECT", "$REPLYTO", "$OURMAIL", "$bbody", "html", "$LIST.html"); print OUT "-> Message id: [$mid]\n"; if ( ! $mid ) { print OUT "-> ERROR: Message inject into lyris for $LIST has failed! [$mid]\n"; `/usr/local/bin/critsit "HTML $LIST [$mid] message into Lyris failed!"`; exit; } print OUT "-> Message inject successful...\n"; print OUT "-> Done.\n\n"; exit; ### # override the copy function ### sub copy { my $bla = shift; my $out = shift; open (F_OUT, ">${out}"); print F_OUT $ad_body; close F_OUT; }