I am developing an application for a client. What i need is, send updates with changed records to clients where the email that needs to be used is extracted from the database. What is weird is that i cant send it to all email addresses... Note that i dont have problems that emails are not delivered but it doesnt want to send it when i click send button... If i use lets say my gmail addres or couple of .com domain addresses it sends but to some other .com or .areo it doesnt... So im thinking, if it delivers to some addresses without anny problems, the script should be ok? Here is the code i use
global $dal;
$dal_TableName = $dal->Table("table_name");
$body="";
foreach(@$keys as $keyblock)
{
$arr=explode("&",refine($keyblock["id"]));
if(count($arr)<1)
continue;
$arr2=array();
$arr2["id"]=urldecode(@$arr[0]);
$where = KeyWhere($arr2);
$rstmp = $dal_TableName->Query($where,"");
$datatmp=db_fetch_array($rstmp );
$body .= "
<html>
<head>
<style type='text/css'>
table.email {
border-width: 1px;
border-spacing: 2px;
border-style: outset;
border-color: #cccccc;
border-collapse: collapse;
background-color: white;
}
table.email td {
border-width: 1px;
padding: 5px;
border-style: inset;
border-color: #cccccc;
background-color: white;
-moz-border-radius: ;
}
</style>
</head>
<body>
<table cellpadding='5' rules='all' style='border:1px solid #cccccc;' class='email'><tbody>
...
<tr><td>Last Update</td><td>" . $datatmp['timestamp'] . "</td><td></td></tr>
</tbody></table>
</body>
</html>
";
// send the email
$subject="STATUS UPDATE";
$arr = runner_mail(array('to' => $datatmp['client_email'], 'subject' => $subject,
'htmlbody' => $body, 'charset' => 'UTF-8'));
}
$result["txt"] = "Email is sent.";
// if error happened print a message on the web page
if (!$arr["mailed"])
{
$errmsg = "Error happened: <br>";
$errmsg.= "File: " . $arr["errors"][0]["file"] . "<br>";
$errmsg.= "Line: " . $arr["errors"][0]["line"] . "<br>";
$errmsg.= "Description: " . $arr["errors"][0]["description"] . "<br>";
$result["txt"] = $errmsg;
}
what else could be the problem?
Also, i need to update date and time in the database after email is sent. But im already using timestamp for recording changes when record is edited so i cant use second one. tried to set last_email_sent=now() but it doesnt work...
Anny ideas for anny of my problems?
Thank you!