LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   my sendmail suddenly stop working.. (https://www.linuxquestions.org/questions/programming-9/my-sendmail-suddenly-stop-working-509559/)

uthinkicare 12-11-2006 09:10 PM

my sendmail suddenly stop working..
 
Hi, below is my sendmail script. It will run throught my cronjob.

Code:

<?

$link = mysql_connect("127.0.0.1", "mysql")    or die("Could not connect: " . mysql_error());
mysql_select_db("ttmodule", $link) or die("Unable to select database: . mysql_error()");






$selectSqlOne= "SELECT * FROM indexpri ORDER BY indexPriNo ASC ";
$resultOne = mysql_query($selectSqlOne, $link);
if(!$resultOne) die("Invalid Query: " .mysql_error() ."<br>" .$selectSqlOne);


while($row1 = mysql_fetch_array($resultOne))
{

        $secondaryTbl = $row1["indexSecTbl"];
        $selectSqlTwo= "SELECT * FROM $secondaryTbl ORDER BY indexSecNo ASC ";
        $resultTwo = mysql_query($selectSqlTwo, $link);
        if(!$resultTwo) die("Invalid Query: " .mysql_error() ."<br>" .$selectSqlTwo);


while($row2 = mysql_fetch_array($resultTwo))
{



        $mainTbl = $row2["mainTbl"];
        $selectSqlThree = "SELECT ttNo, ttCompany, ttStatus, ttEngrAsgn, ttNewTime FROM $mainTbl where ttStatus!='Closed' ORDER BY ttNo";
        $resultThree = mysql_query($selectSqlThree, $link);
        if(!$resultThree) die("Invalid Query: " .mysql_error() ."<br>" .$selectSqlThree);


while($row3=mysql_fetch_array($resultThree))
{


        $no=$row3["ttNo"];
        $comp=$row3["ttCompany"];
        $stat=$row3["ttStatus"];
        $engr=$row3["ttEngrAsgn"];
        $time=$row3["ttNewTime"];


        $to = "tester<test@hotmail.com>";
        $subject = "List Of Unclosed Tickets";
        $message = "";

        $message .= "Ticket Number:"."\n".$no."<br></br>"."Company:"."\n".$comp."<br></br>"."Status:"."\n".$stat."<br></br>"."Raised Date:"."\n".$time."<br></br>"."Engineer Assigned:"."\n".$engr."<br></br>"."\n------------------------------------"."<br></br>";

        $headers = "From: TTM\r\n" .
      'X-Mailer: PHP/' . phpversion() . "\r\n" .
      "MIME-Version: 1.0\r\n" .
      "Content-Type: text/html; charset=utf-8\r\n" .
      "Content-Transfer-Encoding: 8bit\r\n\r\n";


}
}
}

        mail($to, $subject, $message, $headers);


?>

when i do a tail -f /var/log/maillog/, it shows the following..
Code:

[root@localhost ~]# tail -f /var/log/maillog
Dec 12 11:07:19 localhost sendmail[31638]: kBBN020B029378: kBC352qo031638: sender notify: Warning: could not send message for past 4 hours
Dec 12 11:07:19 localhost sendmail[31638]: kBC352qo031638: to=<root@localhost.localdomain>, delay=00:00:00, mailer=local, pri=31870, stat=queued
Dec 12 11:07:20 localhost sendmail[31638]: kBBMj2jF029257: kBC352qp031638: sender notify: Warning: could not send message for past 4 hours
Dec 12 11:07:20 localhost sendmail[31638]: kBC352qp031638: to=<root@localhost.localdomain>, delay=00:00:00, mailer=local, pri=31870, stat=queued
Dec 12 11:07:20 localhost sendmail[31638]: kBBMe2M4029216: kBC352qq031638: sender notify: Warning: could not send message for past 4 hours
Dec 12 11:07:20 localhost sendmail[31638]: kBC352qq031638: to=<root@localhost.localdomain>, delay=00:00:00, mailer=local, pri=32318, stat=queued
Dec 12 11:07:20 localhost sendmail[31638]: kBBN028C029376: kBC352qr031638: sender notify: Warning: could not send message for past 4 hours
Dec 12 11:07:20 localhost sendmail[31638]: kBC352qr031638: to=<root@localhost.localdomain>, delay=00:00:00, mailer=local, pri=32318, stat=queued
Dec 12 11:07:20 localhost sendmail[31638]: kBBMt1j0029338: kBC352qs0
31638: sender notify: Warning: could not send message for past 4 hours
Dec 12 11:07:20 localhost sendmail[31638]: kBC352qs031638: to=<root@localhost.localdomain>, delay=00:00:00, mailer=local, pri=32318, stat=queued
Dec 12 11:07:20 localhost sendmail[31638]: kBBMo1F6029298: kBC352qt031638: sender notify: Warning: could not send message for past 4 hours
Dec 12 11:07:20 localhost sendmail[31638]: kBC352qt031638: to=<root@localhost.localdomain>, delay=00:00:00, mailer=local, pri=32318, stat=queued
Dec 12 11:07:21 localhost sendmail[31638]: kBBN52Yv029421: kBC352qu031638: sender notify: Warning: could not send message for past 4 hours
Dec 12 11:07:21 localhost sendmail[31638]: kBC352qu031638: to=<root@localhost.localdomain>, delay=00:00:00, mailer=local, pri=32318, stat=queued
Dec 12 11:07:21 localhost sendmail[31638]: kBBMj2Kv029258: kBC352qv031638: sender notify: Warning: could not send message for past 4 hours
Dec 12 11:07:21 localhost sendmail[31638]: kBC352qv031638: to=<root@localhost.localdomain>, delay=00:00:00, mailer=local, pri=32318, stat=queued
Dec 12 11:08:01 localhost sendmail[31683]: kBC361pK031683: from=root, size=384, class=0, nrcpts=1, msgid=<200612120306.kBC361pK031683@localhost.localdomain>, relay=root@localhost
Dec 12 11:08:01 localhost sendmail[31683]: kBC361pK031683: to=awhanwei<aw_hanwei@hotmail.com>, delay=00:02:00, mailer=esmtp, pri=30384, dsn=4.4.3, stat=queued
Dec 12 11:08:01 localhost sendmail[31681]: kBC361Bd031681: from=root, size=328, class=0, nrcpts=1, msgid=<200612120306.kBC361Bd031681@localhost.localdomain>, relay=root@localhost
Dec 12 11:08:01 localhost sendmail[31695]: kBC381R7031695: SYSERR(root): hash map "Alias0": missing map file /etc/mail/aliases.db: No such file or directory
Dec 12 11:08:01 localhost sendmail[31695]: kBC381R7031695: from=<root@localhost.localdomain>, size=607, class=0, nrcpts=1, msgid=<200612120306.kBC361Bd031681@localhost.localdomain>, proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Dec 12 11:08:01 localhost sendmail[31695]: kBC381R7031695: to=<root@localhost.localdomain>, delay=00:00:00, mailer=local, pri=30607, stat=queued
Dec 12 11:08:01 localhost sendmail[31681]: kBC361Bd031681: to=root, ctladdr=root (0/0), delay=00:02:00, xdelay=00:00:00, mailer=relay, pri=30328, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (kBC381R7031695 Message accepted for delivery)

my sendmail suddenly stop working.. can anyone troubleshoot for me??

thanks...

dombrowsky 01-11-2007 11:50 PM

I'm not sure what the source code you posted has to do with the question. It looks like a script to send out an email containing some information. I don't see how its relevant.

I think the problem is whatever's making up the domain name localhost.localdomain. I think that's going to be parsed as a FQDN, and the resolver will try and turn it into an IP address. But that's just a guess.

billymayday 01-12-2007 02:06 AM

It certainly looks like you are missing an alias file you have referenced. I use postfix, so can't tell you the db build command. Try man aliases - it should give you the sendmail command to create the aliases db from the aliases file (in postfix is postalias filename)


All times are GMT -5. The time now is 04:32 AM.