0

Need your kind help on this matter:

  1. I write a PHP code with Oracle DB to send an auto email message to multiple email account

  2. So far, I managed to sent the email message but only few email account received it (e.g. send to 6 recipients but only 2 or 3 received the email)

  3. I also include below error reporting but seems like no error/warning related to email came out

       ini_set('display_startup_errors', 1); 
       ini_set('display_errors', 1);
       error_reporting(-1);
    
  4. I'm using PHP version 5.3.4 and I can't update the PHP version due to access limitation (if want to use PHPmailer)

  5. Sample code as below:

<?php
ini_set('display_startup_errors', 1);
ini_set('display_errors', 1);
error_reporting(-1);

include 'db_conn2.php';

set_time_limit(100);

$to = "manamana@@jujumm.com.sg";
$subject = "Daily Product Report";

//sql - starts below
$strSQL3 = "SELECT NO_ID, PROD from table_A";
$objParse3 = oci_parse ($conn, $strSQL3);
oci_execute ($objParse3);


//Run report 3 email starts below
while($objResult3 = oci_fetch_array($objParse3,OCI_BOTH)){
 $ayam3 .= "<tr><td>".$objResult3["NO_ID"]."</td>";
 $ayam3 .= "<td>".$objResult3["PROD"]."</td></tr>";

 }

$message = "
<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01//EN' 'http://www.w3.org/TR/html4/strict.dtd'>
<html>
<head>
<title>Daily Report</title>
<style>


table {
  border-collapse: collapse;
}

table, td, th {
  border: 1px solid black;
}
th {
  padding: 15px;
}
td {
  padding: 6px;
  text-align: center;
  vertical-align: middle;
}
</style>
</head>
<body>
<b>This is just a test email to confirm email receiption.</b><br/>
<p>Good Day</p>
<p>Dear Sir/Madam</p>
<p>Summary for: ".date('l jS \of F Y', time() - 60 * 60 * 24)."</p>

<p>Detail List:</p>
<table>
<tr>
<th style='background-color:#bcdcfd'>NUMBER</th>
<th style='background-color:#bcdcfd'>PRODUCTNAME</th>
</tr>

". htmlspecialchars_decode($ayam3) ."

</table>

<br/>

<p>[This email report was auto generated by the system on: ".date('l jS \of F Y h:i:s A')."]</p>
<p>Thank you kindly</p>

</body>
</html>
";

// Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";

// More headers
$headers .= 'From: <helpdesk@jujumm.com.sg>' . "\r\n";
$headers .= 'cc: man@jujumm.com.sg' . "\r\n";
$headers .= 'cc: oman@jujumm.com.sg' . "\r\n";
$headers .= 'cc: arman@jujumm.com.sg' . "\r\n";
$headers .= 'cc: roman@jujumm.com.sg' . "\r\n";
$headers .= 'cc: toman@jujumm.com.sg' . "\r\n";

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

Please advice. Thanks.

Emma
  • 27,428
  • 11
  • 44
  • 69
TX6_Prog
  • 1
  • 1
  • This should be on serverfault.com. Okay, here some advice, you must know first what's your server mail software first, inform the sysadmin on the server, and ask, does the domain that you use is set up properly for sending email? Such as DKIM, SPF domain, PTR, and etc. When you don't have SPF on the sending domain, then the email will be droped and automatically marked as spam, 2nd it will be better. Try to use shell and send email from shell to test whether the email is sended properly and use -v/--verbose flag, so you can see the error log. Other than that, PHP use use sendmail cli – Benyamin Limanto Aug 07 '20 at 04:38
  • In my POV, this shouldn't be PHP question, but server related question, mail() function only wrap the sendmail cli command. Try to send email to test mail on http://multirbl.valli.org/ send test mail, and use PHP code to send email there, and see the result why the email is rejected. – Benyamin Limanto Aug 07 '20 at 04:39
  • Seeing that it's only some emails not being received it's most likely not a issue with your code – Epodax Aug 07 '20 at 05:00
  • Thanks for the swift respond. So meaning i need to further check with the server admin. oh, i hope there's another and easiest way to overcome this issue. because its very hard to get the server admin to respond. – TX6_Prog Aug 07 '20 at 05:03

0 Answers0