...

View Full Version : .lib file type question



awayne96
12-04-2009, 10:33 PM
I have a .lib file type that has this following code in it:


}

if( $send_mail_notify eq "yes" )
{
%savedvalues = %values;
$action = $input{'action'};
if($FLAT>0){
init($torow);
}else{
%values = %to_values;
}
$toemail = $values{'email'};
# send email
if( $toemail =~ m/^([\w\-\.\!\%\+]+\@[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)*\.[a-zA-Z0-9\-]+)$/){
my $tosubject = &tempwiz_to($message_to_mail_subject);
$input{'action'} = "message_received";
$values{'inbox'} = "pm.cgi?login=$values{'login'}&ID=$values{'ID'}&action=mail_list";
$body = &tempwiz_to_from;
#print "<pre>$toemail, $from, $tosubject, $body)</pre>";
&sendemail($toemail, $from, $tosubject, $body);
}
%values = %savedvalues;
$input{'action'} = $action;
}

&get_time;


if( $send_mail_notify eq "yes" )

That part of the code triggers for a email to be sent to the users external email account. I have a CGI script that is NOT sending the email to the users external account when they receive a message to the internal messaging system.

Is there something that I need to add to my CGI script for this to work? Here is the CGI script that I have:


#!/usr/bin/perl -w
use CGI::Carp qw(fatalsToBrowser carpout);
use CGI qw(:standard);
use DBD::mysql;
use LWP::Simple;
use URI;
print "Content-type: text/html \n\n";

###############################
# find the root if this is IIS:
###############################
if($ENV{'SERVER_SOFTWARE'} =~ m/IIS/)
{
if($root eq "" && $ENV{'PATH_TRANSLATED'} ne "")
{
my $pt = $ENV{'PATH_TRANSLATED'};
my @pts = split(/\\/, $pt);
$pts[-1] = "";
$root = join "/", @pts;
$OS = "NT";
}
}

###############################
# functions library:
###############################
if(!$dontparse){
require "${root}data/config/pmpre.cfg";
require "${root}lib/mysql.lib";
require "${root}lib/pm.lib";
require "${root}lib/phpbb.lib" if($plugin_phpbb eq "yes");
}

###############################
# Read the data coming from the form..
###############################
if(!$dontparse){ &readit; }
###############################

if($use_cookie eq "yes" && !$dontparse && $input{'ID'}<1 && $input{'action'} ne "register"){
#- retrieve existing cookie
$lp = $req->cookie("pmpre");
my ($clogin, $cID) = split(/\|/, pm_decode($lp));
if(($clogin ne "") and ($cID ne "")){
if($input{'login'} eq ""){
$input{'login'} = $clogin;
}
if($input{'ID'} eq "" && $input{'password'} eq ""){
$input{'ID'} = $cID;
}
}

}


my $count = 0;
my $subject = "New posting";
my $flag = "1";
my $from = "admin";
my $time = &get_time;

$query = "SELECT MAX(mailno) FROM `mailbox`";
my $sth = $dbh->prepare($query);
$sth->execute();
my $data = $sth->fetchrow_array();
my $mailno = ($data + 1);


my $profiles_sth = $dbh->prepare("SELECT * FROM `departures` WHERE `departures_states` = ?") or die $DBI::errstr;
$profiles_sth->execute($input{'state'}) or die $DBI::errstr;
while(my $profiles = $profiles_sth->fetchrow_hashref()){
my $firstname = "$profiles->{'firstname'}";
my $login = "$profiles->{'login'}";
# add personalized mail
my $body = "You have recent posts from your state. <a href=pm.cgi?action=app_list&app=ship1&app_id=".$input{'app_id'}.">Click Here</a> to view it.";

my $mail_sth = $dbh->prepare("INSERT INTO `mailbox` (`mailno`, `time`, `newflag`, `from`, `to`, `subject`, `body`)
VALUES (?, ?, ?, ?, ?, ?, ?)") or die $DBI::errstr;
$mail_sth->execute($mailno, $time, $flag, $from, $login, $subject, $body) or die $DBI::errstr;
$mail_sth->finish;
$count = ($count + 1);
$mailno = ($mailno + 1);
}
$profiles_sth->finish;

print "<br>$count ";

if ($count == 1){
print "Member has";
} else {
print "members have";
}

print " been alerted about this post..<br><br>";
exit;


Now my question is could it be that it is being inserted into the messaging system which is causing it NOT to trigger that email to be sent?

I hope I might be able to get some help regarding this.

Thanks!!!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum