I send the same email from Xataface using the php mail function to both a gmail address and a corporate address where the email is shown in outlook.
Randomly, the email is not correct in outlook. It is always correct in gmail. See screen shots where the same mail is incorrect in outlook, but OK in gmail.
We send about 30 mails a day, one at a time, not in a batch. Many days, there is an email with an error.
I realize this may not be a xataface issue, but I wonder if someone can help.
I don't see how the mail can be OK every time in gmail, but sometimes displayed incorrectly in outlook. I have read about outlook html mail challanges, but I think the code below is relatively simple.
Any ideas would be appreciated.
~=-=-=-=-=-=~
This shows a difference between the outlook and gmail.
outlook view source:
<td>generators: </td><t d=""><br>ESA not working properly #164387<br>925 gen...valve V6-1 doesn't function properly #161297<br>925 gen...V1 valve doesn't function properly #183216 and #228798<br></td>
gmail.
<td>generators: </td><td><br/>ESA not working properly #164387<br/>925 gen...valve V6-1 doesn't function properly #161297<br/>925 gen...V1 valve doesn't function properly #183216 and #228798<br/></td></tr>
~=-=-=-=-=-=~
outlook view source, the whole table:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>
<body><table rules="all" border="1" style="border: 1px solid #211D57;" cellpadding="5"><tr style="background: #FEE5DF;"><td>Date reported: </td><td>2013-07-15</td></tr><tr style="background: #FEE5DF;"><td>Shift reported: </td><td>Days</td></tr><tr style="background: #FEE5DF;"><td>Reported by: </td><td>Cathy</td></tr><tr style="background: #FEE5DF;"><td>furnace_304: </td><td>RBO not functioning properly Work order #141797</td></tr><tr style="background: #FEE5DF;"><td>furnace_305: </td><td>RBO not functioning properly #141798</td></tr><tr style="background: #FEE5DF;"><td>furnace_314: </td><td>muffle is in bad shape #239836</td></tr><tr style="background: #FEE5DF;"><td>furnace_315: </td><td>Moisture coming out of top petcocks #189170<br>Air ducts for burners boxes don't blow air #189736<br></td></tr><tr style="background: #FEE5DF;"><td>furnace_316: </td><td>Moisture comes out of top petcock #189171</td></tr><tr style="background: #FEE5DF;"><td>generators: </td><t d=""><br>ESA not working properly #164387<br>925 gen...valve V6-1 doesn't function properly #161297<br>925 gen...V1 valve doesn't function properly #183216 and #228798<br></td></tr><tr style="background: #FEE5DF;"><td>miscellaneous: </td><td>#567 torque tester # 241075 not working properly</td></tr><tr style="background: #FEE5DF;"><td>createdtime: </td><td>2013-07-15 14:08:28</td></tr><tr style="background: #FEE5DF;"><td>updatedtime: </td><td>2013-07-15 14:08:05</td></tr><tr style="background: #FEE5DF;"><td>id-number: </td><td>36</td></tr></table></body></html>
~=-=-=-=-=-=~
gmail:
<html><body><table rules="all" border="1" style="border: 1px solid #211D57;" cellpadding="5"><tr style='background: #FEE5DF;'><td>Date reported: </td><td>2013-07-15</td></tr><tr style='background: #FEE5DF;'><td>Shift reported: </td><td>Days</td></tr><tr style='background: #FEE5DF;'><td>Reported by: </td><td>Cathy</td></tr><tr style='background: #FEE5DF;'><td>furnace_304: </td><td>RBO not functioning properly Work order #141797</td></tr><tr style='background: #FEE5DF;'><td>furnace_305: </td><td>RBO not functioning properly #141798</td></tr><tr style='background: #FEE5DF;'><td>furnace_314: </td><td>muffle is in bad shape #239836</td></tr><tr style='background: #FEE5DF;'><td>furnace_315: </td><td>Moisture coming out of top petcocks #189170<br/>Air ducts for burners boxes don't blow air #189736<br/></td></tr><tr style='background: #FEE5DF;'><td>furnace_316: </td><td>Moisture comes out of top petcock #189171</td></tr><tr style='background: #FEE5DF;'><td>generators: </td><td><br/>ESA not working properly #164387<br/>925 gen...valve V6-1 doesn't function properly #161297<br/>925 gen...V1 valve doesn't function properly #183216 and #228798<br/></td></tr><tr style='background: #FEE5DF;'><td>miscellaneous: </td><td>#567 torque tester # 241075 not working properly</td></tr><tr style='background: #FEE5DF;'><td>createdtime: </td><td>2013-07-15 14:08:28</td></tr><tr style='background: #FEE5DF;'><td>updatedtime: </td><td>2013-07-15 14:08:05</td></tr><tr style='background: #FEE5DF;'><td>id-number: </td><td>36</td></tr></table></body></html>
~=-=-=-=-=-=~
This is my code. This one appears in the "table".php
function after_action_new($params = array())
{
$record =& $params['record'];
$subject1 = 'CSD1-Sinter Shift Report Record Submitted';
$headers1 = "From: " . "rpt1" . "\r\n";
$headers1 .= "Reply-To: " . "Do-not@reply" . "\r\n";
$headers1 .= "MIME-Version: 1.0\r\n";
$headers1 .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$message1 = '<html><body>';
$message1 .= '<table rules="all" border="1" style="border: 1px solid #211D57;" cellpadding="5">';
$rrecord = df_get_record('sf_csd1_sinter', array(
'sfid' => $record->val('sfid')
));
$message1 .= "<tr style='background: #FEE5DF;'><td>Date reported: </td><td>" . $rrecord->strval('sfdate') . "</td></tr>";
$message1 .= "<tr style='background: #FEE5DF;'><td>Shift reported: </td><td>" . $rrecord->strval('sfshift') . "</td></tr>";
$message1 .= "<tr style='background: #FEE5DF;'><td>Reported by: </td><td>" . $rrecord->strval('reportedby') . "</td></tr>";
$message1 .= "<tr style='background: #FEE5DF;'><td>furnace_304: </td><td>" . $rrecord->strval('furnace_304') . "</td></tr>";
$message1 .= "<tr style='background: #FEE5DF;'><td>furnace_305: </td><td>" . $rrecord->strval('furnace_305') . "</td></tr>";
$message1 .= "<tr style='background: #FEE5DF;'><td>furnace_314: </td><td>" . $rrecord->strval('furnace_314') . "</td></tr>";
$message1 .= "<tr style='background: #FEE5DF;'><td>furnace_315: </td><td>" . $rrecord->strval('furnace_315') . "</td></tr>";
$message1 .= "<tr style='background: #FEE5DF;'><td>furnace_316: </td><td>" . $rrecord->strval('furnace_316') . "</td></tr>";
$message1 .= "<tr style='background: #FEE5DF;'><td>generators: </td><td>" . $rrecord->strval('generators') . "</td></tr>";
$message1 .= "<tr style='background: #FEE5DF;'><td>miscellaneous: </td><td>" . $rrecord->strval('miscellaneous') . "</td></tr>";
$message1 .= "<tr style='background: #FEE5DF;'><td>createdtime: </td><td>" . $rrecord->strval('createdtime') . "</td></tr>";
$message1 .= "<tr style='background: #FEE5DF;'><td>updatedtime: </td><td>" . $rrecord->strval('updatedtime') . "</td></tr>";
$message1 .= "<tr style='background: #FEE5DF;'><td>id-number: </td><td>" . $rrecord->strval('sfid') . "</td></tr>";
$message1 .= "</table>";
$message1 .= "</body></html>";
// replace \r and \n with html br tags to preserve new lines in the html email...
$body1 = isset($message1) ? preg_replace('#(\\r\\n|\\n|\\r)#', '<br/>', $message1) : false;
if (mail($to1, $subject1, $body1, $headers1)) {
echo '<br><br><h1><span style="background-color:#00ff00;">Your email has been sent.</span></h1><br>';
} else {
echo '<br><br /><h1><span style="background-color:#ff0000;">There was a problem sending the email. Please try again.</span></h1><br />';
}
echo '<br /><br /><br /><span style="font-size:16px;">Press the BACK button in your browser to go back.</span><br />';
}
~=-=-=-=-=-=~